mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-22 12:03:44 -05:00
Merge pull request #8295 from Microsoft/anyDefaultsToAny
Variable of type any has initial type any in control flow analysis
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user