File tree 1 file changed +4
-6
lines changed 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -37404,12 +37404,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
37404
37404
return undefined;
37405
37405
}
37406
37406
37407
- // Only a single-argument function can be inferred to be a type predicate
37408
- if (func.parameters.length !== 1) return undefined;
37409
-
37410
37407
// The body must be an expression, or a block containing a lone return statement
37411
37408
if (!func.body) return undefined;
37412
37409
37410
+ const functionFlags = getFunctionFlags(func);
37411
+ // Only a normal single-argument function can be inferred to be a type predicate
37412
+ if (functionFlags !== FunctionFlags.Normal || func.parameters.length !== 1) return undefined;
37413
+
37413
37414
let returnExpression: Expression | undefined;
37414
37415
if (func.body.kind === SyntaxKind.Block) {
37415
37416
const body = func.body as Block;
@@ -37421,9 +37422,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
37421
37422
}
37422
37423
if (!returnExpression) return undefined;
37423
37424
37424
- const functionFlags = getFunctionFlags(func);
37425
- if (functionFlags !== FunctionFlags.Normal) return undefined;
37426
-
37427
37425
const predicate = checkIfExpressionRefinesAnyParameter(returnExpression);
37428
37426
if (predicate) {
37429
37427
const [i, type] = predicate;
You can’t perform that action at this time.
0 commit comments