False branch of in-operator type guard for non-union intersection is not never #37039
Labels
Breaking Change
Would introduce errors in existing code
Bug
A bug in TypeScript
Fix Available
A PR has been opened for this issue
Milestone
TypeScript Version: Nightly
Search Terms: intersection guard, intersection never
Expected behavior: In the first function, the type of
obj
in theelse
block isnever
Actual behavior: In the first function, the type of
obj
in theelse
block is{ str: string } & { num: number }
, the same as in theif
block.Related Issues: I didn't find any.
Code
Output
Compiler Options
Playground Link: Provided
The text was updated successfully, but these errors were encountered: