@@ -15462,11 +15462,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
15462
15462
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ?
15463
15463
createTypePredicateFromTypePredicateNode(type, signature) :
15464
15464
jsdocPredicate || noTypePredicate;
15465
- } else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType === booleanType)) {
15466
- const {declaration} = signature;
15467
- signature.resolvedTypePredicate = noTypePredicate; // avoid infinite loop
15465
+ }
15466
+ else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType === booleanType)) {
15467
+ const { declaration } = signature;
15468
+ signature.resolvedTypePredicate = noTypePredicate; // avoid infinite loop
15468
15469
signature.resolvedTypePredicate = getTypePredicateFromBody(declaration, signature) || noTypePredicate;
15469
- } else {
15470
+ }
15471
+ else {
15470
15472
signature.resolvedTypePredicate = noTypePredicate;
15471
15473
}
15472
15474
}
@@ -37405,7 +37407,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
37405
37407
let singleReturn: Expression | undefined;
37406
37408
if (func.body && func.body.kind !== SyntaxKind.Block) {
37407
37409
singleReturn = func.body; // arrow function
37408
- } else {
37410
+ }
37411
+ else {
37409
37412
if (functionHasImplicitReturn(func)) return undefined;
37410
37413
37411
37414
const bailedEarly = forEachReturnStatement(func.body as Block, returnStatement => {
@@ -37445,7 +37448,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
37445
37448
}
37446
37449
37447
37450
function checkIfExpressionRefinesParameter(expr: Expression, param: ParameterDeclaration, initType: Type): Type | undefined {
37448
- const antecedent = (expr as Expression & {flowNode?: FlowNode}).flowNode ?? { flags: FlowFlags.Start };
37451
+ const antecedent = (expr as Expression & { flowNode?: FlowNode; }).flowNode ?? { flags: FlowFlags.Start };
37449
37452
const trueCondition: FlowCondition = {
37450
37453
flags: FlowFlags.TrueCondition,
37451
37454
node: expr,
@@ -37462,7 +37465,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
37462
37465
const falseCondition: FlowCondition = {
37463
37466
...trueCondition,
37464
37467
flags: FlowFlags.FalseCondition,
37465
- }
37468
+ };
37466
37469
const falseType = getFlowTypeOfReference(param.name, initType, initType, func, falseCondition);
37467
37470
const candidateFalse = filterType(initType, t => !isTypeSubtypeOf(t, trueType));
37468
37471
if (isTypeIdenticalTo(candidateFalse, falseType)) {
0 commit comments