Quick bail out when narrowing type any by equality
This commit is contained in:
parent
37d6ab3e13
commit
6e8182d7e7
1 changed files with 3 additions and 0 deletions
|
@ -8586,6 +8586,9 @@ namespace ts {
|
|||
}
|
||||
|
||||
function narrowTypeByEquality(type: Type, operator: SyntaxKind, value: Expression, assumeTrue: boolean): Type {
|
||||
if (type.flags & TypeFlags.Any) {
|
||||
return type;
|
||||
}
|
||||
if (operator === SyntaxKind.ExclamationEqualsToken || operator === SyntaxKind.ExclamationEqualsEqualsToken) {
|
||||
assumeTrue = !assumeTrue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue