Closed samhh closed 2 years ago
A minimal repro:
// The compiler highlights that `bad` is missing, but we'd instead like to
// prioritise reporting the absence of `good`.
// You can flip the union in `F` and drop the `Partial` in `H` to accomplish
// this, but we need to keep the `Partial` (functionally at least).
type F<A extends string> = G<A> | H<A>
type G<A extends string> = { [K in A]: any }
type H<A extends string> = Partial<G<A>> & { bad: any }
const x: F<'good'> = {}
Because our match function(s) can either be exhaustive or wildcard, the error message in case of missing properties pushes you towards adding the wildcard case. It'd be a lot more helpful if we could instead get help about which exhaustive properties are missing.