diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a16ac45852853..7f04a2adbfe16 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12850,7 +12850,7 @@ namespace ts { case SyntaxKind.NeverKeyword: return neverType; case SyntaxKind.ObjectKeyword: - return node.flags & NodeFlags.JavaScriptFile ? anyType : nonPrimitiveType; + return node.flags & NodeFlags.JavaScriptFile && !noImplicitAny ? anyType : nonPrimitiveType; case SyntaxKind.ThisType: case SyntaxKind.ThisKeyword: return getTypeFromThisTypeNode(node as ThisExpression | ThisTypeNode);