Skip to content

Commit ecc9361

Browse files
committed
Variable of type any has initial type any in control flow analysis
1 parent dc60e68 commit ecc9361

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7972,7 +7972,7 @@ namespace ts {
79727972
return type;
79737973
}
79747974
const declaration = localOrExportSymbol.valueDeclaration;
7975-
const defaultsToDeclaredType = !strictNullChecks || !declaration ||
7975+
const defaultsToDeclaredType = !strictNullChecks || type.flags & TypeFlags.Any || !declaration ||
79767976
declaration.kind === SyntaxKind.Parameter || isInAmbientContext(declaration) ||
79777977
getContainingFunctionOrModule(declaration) !== getContainingFunctionOrModule(node);
79787978
if (defaultsToDeclaredType && !(type.flags & TypeFlags.Narrowable)) {

0 commit comments

Comments
 (0)