Skip to content

Commit 908548e

Browse files
committed
'in' operator shouldn't narrow {} originating in unknown
1 parent 891cdc5 commit 908548e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/checker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25150,7 +25150,7 @@ namespace ts {
2515025150

2515125151
function narrowByInKeyword(type: Type, name: __String, assumeTrue: boolean) {
2515225152
if (type.flags & TypeFlags.Union
25153-
|| type.flags & TypeFlags.Object && declaredType !== type
25153+
|| type.flags & TypeFlags.Object && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
2515425154
|| isThisTypeParameter(type)
2515525155
|| type.flags & TypeFlags.Intersection && every((type as IntersectionType).types, t => t.symbol !== globalThisSymbol)) {
2515625156
return filterType(type, t => isTypePresencePossible(t, name, assumeTrue));

0 commit comments

Comments
 (0)