Variable of type any has initial type any in control flow analysis

This commit is contained in:
Anders Hejlsberg
2016-04-25 17:22:06 -07:00
parent dc60e68468
commit ecc936167f
+1 -1
View File
@@ -7972,7 +7972,7 @@ namespace ts {
return type;
}
const declaration = localOrExportSymbol.valueDeclaration;
const defaultsToDeclaredType = !strictNullChecks || !declaration ||
const defaultsToDeclaredType = !strictNullChecks || type.flags & TypeFlags.Any || !declaration ||
declaration.kind === SyntaxKind.Parameter || isInAmbientContext(declaration) ||
getContainingFunctionOrModule(declaration) !== getContainingFunctionOrModule(node);
if (defaultsToDeclaredType && !(type.flags & TypeFlags.Narrowable)) {