Annotated solution
Published September 2, 2026The solution
type PartialBy<T, K extends keyof T> = Flatten<Omit<T, K> & Partial<Pick<T, K>>>
The common wrong answer
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
Everything about this is right except the shape. `{ a: string } & { b?: number }` accepts and rejects exactly the same values as `{ a: string; b?: number }`, but it is not the same *type*, and `Equal` compares types rather than behaviour. An intersection is two objects standing next to each other; the check asks for one.
Line by line
Omit<T, K> & Partial<Pick<T, K>>Split the object in two: the keys that stay as they are, and the keys that become optional. Each half is easy on its own.
Flatten<...>A homomorphic mapping over the intersection walks every key once and rebuilds a single object — and because it is homomorphic, the `?` survives the trip.
Takeaway
Intersections are how you assemble an object type; a homomorphic mapping is how you finish one. Assembling without finishing is the single most common reason a correct-looking solution fails these checks.

