Skip to content

#13063 Fix strictNullChecks breaking typeof#13192

Merged
mhegazy merged 2 commits intomicrosoft:masterfrom
slawomir:13063-strictNullChecks-breaks-typeof
Dec 28, 2016
Merged

#13063 Fix strictNullChecks breaking typeof#13192
mhegazy merged 2 commits intomicrosoft:masterfrom
slawomir:13063-strictNullChecks-breaks-typeof

Conversation

@slawomir
Copy link
Copy Markdown
Contributor

@slawomir slawomir commented Dec 28, 2016

Fixes #13063

 * Allow typeof to use not-auto variable in strictNullChecks mode
Comment thread src/compiler/checker.ts Outdated
// 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
Copy Markdown
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
Copy Markdown
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