* Fix #38608

* Work for narrowed non-unions

* Add comment
This commit is contained in:
Jack Williams authored and GitHub committed 2021-03-11 07:32:49 -08:00
1 parent 79d3058b83
commit 3d6650eb4f
9 files changed
+369 -11

No files matched your search

+2 -1
View File
@@ -22963,7 +22963,8 @@ namespace ts {
}
function narrowByInKeyword(type: Type, literal: LiteralExpression, assumeTrue: boolean) {
if (type.flags & (TypeFlags.Union | TypeFlags.Object)
if (type.flags & TypeFlags.Union
|| type.flags & TypeFlags.Object && declaredType !== type
|| isThisTypeParameter(type)
|| type.flags & TypeFlags.Intersection && every((type as IntersectionType).types, t => t.symbol !== globalThisSymbol)) {
const propName = escapeLeadingUnderscores(literal.text);