Skip to content

Commit 11066b2

Browse files
authoredOct 18, 2022
Rename internal functions to narrowTypeBySwitchOnTypeOf and narrowTypeByInKeyword (#51215)
1 parent 4c9afe8 commit 11066b2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎src/compiler/checker.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -25037,7 +25037,7 @@ namespace ts {
2503725037
type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
2503825038
}
2503925039
else if (expr.kind === SyntaxKind.TypeOfExpression && isMatchingReference(reference, (expr as TypeOfExpression).expression)) {
25040-
type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
25040+
type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
2504125041
}
2504225042
else {
2504325043
if (strictNullChecks) {
@@ -25329,7 +25329,7 @@ namespace ts {
2532925329
!!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
2533025330
}
2533125331

25332-
function narrowByInKeyword(type: Type, nameType: StringLiteralType | NumberLiteralType | UniqueESSymbolType, assumeTrue: boolean) {
25332+
function narrowTypeByInKeyword(type: Type, nameType: StringLiteralType | NumberLiteralType | UniqueESSymbolType, assumeTrue: boolean) {
2533325333
const name = getPropertyNameFromType(nameType);
2533425334
const isKnownProperty = someType(type, t => isTypePresencePossible(t, name, /*assumeTrue*/ true));
2533525335
if (isKnownProperty) {
@@ -25411,7 +25411,7 @@ namespace ts {
2541125411
return getTypeWithFacts(type, assumeTrue ? TypeFacts.NEUndefined : TypeFacts.EQUndefined);
2541225412
}
2541325413
if (isMatchingReference(reference, target)) {
25414-
return narrowByInKeyword(type, leftType as StringLiteralType | NumberLiteralType | UniqueESSymbolType, assumeTrue);
25414+
return narrowTypeByInKeyword(type, leftType as StringLiteralType | NumberLiteralType | UniqueESSymbolType, assumeTrue);
2541525415
}
2541625416
}
2541725417
break;
@@ -25611,7 +25611,7 @@ namespace ts {
2561125611
neverType);
2561225612
}
2561325613

25614-
function narrowBySwitchOnTypeOf(type: Type, switchStatement: SwitchStatement, clauseStart: number, clauseEnd: number): Type {
25614+
function narrowTypeBySwitchOnTypeOf(type: Type, switchStatement: SwitchStatement, clauseStart: number, clauseEnd: number): Type {
2561525615
const witnesses = getSwitchClauseTypeOfWitnesses(switchStatement);
2561625616
if (!witnesses) {
2561725617
return type;

0 commit comments

Comments
 (0)