Skip to content

Optional chaining control flow refinements missing #34570

@ahejlsberg

Description

@ahejlsberg

TypeScript Version: 3.7.x-dev.20191017

Code

In the comments on #33736, several issues related to control flow analysis of optional chaining constructs are mentioned. Specifically:

#33736 (comment) -- No narrowing in switch statement.
#33736 (comment) -- No narrowing following assertion.
#33736 (comment) -- No narrowing in false branch of if statement.

Expected behavior:

Proper narrowing as indicated in the examples.

Actual behavior:

No narrowing.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions