Skip to content

Commit

Permalink
'in' operator shouldn't narrow {} originating in unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
ahejlsberg committed Sep 2, 2022
1 parent 891cdc5 commit 908548e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Expand Up @@ -25150,7 +25150,7 @@ namespace ts {

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

0 comments on commit 908548e

Please sign in to comment.