From ab993c2b48e60379c991258c504b5d2ea55832dc Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 21 Apr 2020 09:49:11 -0700 Subject: [PATCH] Small fix --- src/compiler/checker.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f5ec5c32a7854..b6afc5582d269 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7529,9 +7529,11 @@ namespace ts { } function isAutoTypedProperty(symbol: Symbol) { - // A property is auto-typed in noImplicitAny mode when its declaration has no type annotation or initializer. + // A property is auto-typed when its declaration has no type annotation or initializer and we're in + // noImplicitAny mode or a .js file. const declaration = symbol.valueDeclaration; - return noImplicitAny && declaration && isPropertyDeclaration(declaration) && !declaration.type && !declaration.initializer; + return declaration && isPropertyDeclaration(declaration) && !getEffectiveTypeAnnotationNode(declaration) && + !declaration.initializer && (noImplicitAny || isInJSFile(declaration)); } function getDeclaringConstructor(symbol: Symbol) {