Quick bail out when narrowing type any by equality

This commit is contained in:
Anders Hejlsberg 2016-09-12 12:41:15 -07:00 committed by Mohamed Hegazy
parent b8759b38ee
commit 88349ab436

View file

@ -8522,6 +8522,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;
}