Skip to content

Nested conditional generic types yields boolean not assignable to true | false | undefined. #22630

Description

@Griffork

TypeScript Version: 2.8RC

Search Terms:

Code

image

End of friday, so I don't have enough time to make a proper repro, hopefully this will be enough to go by:

typeRecursivePartial<T>={[paraminkeyofT]?: T[param]extendsobject ? RecursivePartial<T[param]> : T[param]};interfaceUpdateValue<T>{$set: Textendsobject? RecursivePartial<T>: T;}interfaceArrayUpdate<T>{$wildcard: WriteQuery<T>;}exporttypeTypeWriteQuery<T>=TextendsArray<infer U>
?
Partial<ArrayUpdate<U>>
:
Textendsobject
?
WriteQuery<T>
:
Partial<UpdateValue<T>>;exporttypeWriteQuery<T>={[paraminkeyofT]?: TypeWriteQuery<T[param]>};///----- Erroring code:interfaceApproved{approved: boolean;}varcheck=<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

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions