-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Conditional types break with property chaining #32735
Copy link
Copy link
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Conditional TypesThe issue relates to conditional typesThe issue relates to conditional typesFixedA PR has been merged for this issueA PR has been merged for this issueNeeds Human ReviewThis issue has a backlog check awaiting maintainer review.This issue has a backlog check awaiting maintainer review.
Milestone
Description
Activity
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Conditional TypesThe issue relates to conditional typesThe issue relates to conditional typesFixedA PR has been merged for this issueA PR has been merged for this issueNeeds Human ReviewThis issue has a backlog check awaiting maintainer review.This issue has a backlog check awaiting maintainer review.
TypeScript Version: 3.5.1
Search Terms:
property chaining, generic, object type param, conditional type
Code
Modified version of Bruce Pascoe (@fatcerberus) ' attempt to break TS.
Expected behavior:
Each access to
.drosteshould alternate betweenstringandnumber.Or give a max instantiation depth/count error.
Actual behavior:
It alternates between
stringandnumberand then breaks after while.From that point, it just sticks with
string.No errors given.
Playground Link:
Playground
Related Issues:
It is similar to #32707
Except, it gives up and resolves the type to
string, rather thanany.