Skip to content

Fix narrowing of optional chains #36089

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 8, 2020
Merged

Fix narrowing of optional chains #36089

merged 3 commits into from
Jan 8, 2020

Conversation

ahejlsberg
Copy link
Member

Fixes #35842.

// When operator is === and type of value is undefined, null and undefined is removed from type of obj in false branch.
// When operator is !== and type of value is undefined, null and undefined is removed from type of obj in true branch.
// When operator is == and type of value is null or undefined, null and undefined is removed from type of obj in false branch.
// When operator is != and type of value is null or undefined, null and undefined is removed from type of obj in true branch.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤓

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong behaviour of the compiler in the case with strict null check and optional chaining
2 participants