Closed as not planned
Description
Bug Report
π Search Terms
π Version & Regression Information
- This is wrong behaivor of
extends
operator - This changed between versions 3.3.3 and 3.5.1
- Most likely this is the reason: Relate source types covered by a target discriminated unionΒ #30779
β― Playground Link
π» Code
type A = {x:string} | {x:number} | {x: symbol}
type B = {x:string} | {x:number} | {x: boolean}
// ^ literal type here
type C = {x:string} | {x:number}
type X = {x:string | number}
// `X extends B` but not A or C
type X_A = X extends A ? "X extends A" : "X not extends A";
// ^? X not extends A
type X_B = X extends B ? "X extends B" : "X not extends B";
// ^? X extends B
type X_C = X extends C ? "X extends C" : "X not extends C";
// ^? X not extends C
the bug is reproduced with any literal type instead of boolean
π Actual behavior
X
not extends A
X
extends B
;
X
not extends C
π Expected behavior
X
not extends A
X
not extends B
X
not extends C