- Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
TypeScript Version: 2.8RC
Search Terms:
Code
End of friday, so I don't have enough time to make a proper repro, hopefully this will be enough to go by:
type RecursivePartial<T> = { [param in keyof T]?: T[param] extends object ? RecursivePartial<T[param]> : T[param] }; interface UpdateValue<T> { $set: T extends object? RecursivePartial<T>: T; } interface ArrayUpdate<T> { $wildcard: WriteQuery<T>; } export type TypeWriteQuery<T> = T extends Array<infer U> ? Partial<ArrayUpdate<U>> : T extends object ? WriteQuery<T> : Partial<UpdateValue<T>> ; export type WriteQuery<T> = { [param in keyof T]?: TypeWriteQuery<T[param]> }; ///----- Erroring code: interface Approved { approved: boolean; } var check = <WriteQuery<Approved>>{ approved: { $set: true } };
Expected behavior:
Works fine (unless I've made another mistake).
Actual behavior:
Errors that boolean
isn't assignable to true | false | undefined
because boolean
isn't assignable to false
.
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug