From de9171e711b54eb29204d7cf50d855f875005b63 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 3 Jun 2024 15:41:26 -0700 Subject: [PATCH] Formatting + handle unreachable code --- src/compiler/checker.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 675a2d66bfe..ac7e4126b84 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -328,6 +328,7 @@ import { getJSXImplicitImportBase, getJSXRuntimeImport, getJSXTransformEnabled, + getLambdaArgument, getLeftmostAccessExpression, getLineAndCharacterOfPosition, getMembersOfDeclaration, @@ -1106,7 +1107,6 @@ import { WideningContext, WithStatement, YieldExpression, - getLambdaArgument, } from "./_namespaces/ts.js"; import * as moduleSpecifiers from "./_namespaces/ts.moduleSpecifiers.js"; import * as performance from "./_namespaces/ts.performance.js"; @@ -28024,7 +28024,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { else { // Unreachable code errors are reported in the binding phase. Here we // simply return the non-auto declared type to reduce follow-on errors. - type = convertAutoToAny(declaredType); + type = inLambdaArg ? initialType : convertAutoToAny(declaredType); } if (sharedFlow) { // Record visited node and the associated type in the cache.