Skip to content

#13063 Fix strictNullChecks breaking typeof #13192

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

Conversation

slawomir
Copy link
Contributor

@slawomir slawomir commented Dec 28, 2016

Fixes #13063

 * Allow typeof to use not-auto variable in strictNullChecks mode
@@ -10372,7 +10372,7 @@ namespace ts {
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
// declaration container are the same).
const assumeInitialized = isParameter || isOuterVariable ||
type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & TypeFlags.Any) !== 0) ||
type !== autoType && type !== autoArrayType && (!strictNullChecks || isInTypeQuery(node) || (type.flags & TypeFlags.Any) !== 0) ||
Copy link
Member

Choose a reason for hiding this comment

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

Please put this condition last in the || chain - we want the faster checks first and isInTypeQuery has to walk up the entire tree

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@RyanCavanaugh updated pull request

Add isInTypeQuery as the last OR
@mhegazy mhegazy merged commit e128b94 into microsoft:master Dec 28, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants