Merge pull request #13192 from slawomir/13063-strictNullChecks-breaks-typeof

#13063 Fix strictNullChecks breaking typeof
This commit is contained in:
Mohamed Hegazy
2016-12-28 12:52:21 -08:00
committed by GitHub
5 changed files with 31 additions and 1 deletions

View File

@@ -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 || (type.flags & TypeFlags.Any) !== 0 || isInTypeQuery(node)) ||
isInAmbientContext(declaration);
const flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer);
// A variable is considered uninitialized when it is possible to analyze the entire control flow graph