Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions internal/checker/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -841,10 +841,13 @@ func (c *Checker) getNarrowedTypeWorker(t *Type, candidate *Type, assumeTrue boo
return !c.isTypeDerivedFrom(t, candidate)
})
}
if t.flags&TypeFlagsUnknown != 0 {
t = c.unknownUnionType
}
trueType := c.getNarrowedType(t, candidate, true /*assumeTrue*/, false /*checkDerived*/)
return c.filterType(t, func(t *Type) bool {
return c.recombineUnknownType(c.filterType(t, func(t *Type) bool {
return !c.isTypeSubsetOf(t, trueType)
})
}))
}
if t.flags&TypeFlagsAnyOrUnknown != 0 {
return candidate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if (!isNotNullish(value2)) {
>value2 : unknown

value2;
>value2 : unknown
>value2 : null | undefined
}

declare const value3: unknown;
Expand All @@ -56,7 +56,7 @@ if (!isNullish(value4)) {
>value4 : unknown

value4;
>value4 : unknown
>value4 : {}
}

declare class A { foo: string; }
Expand Down

This file was deleted.