Closed
Description
Bug Report
π Search Terms
type parameter union regression
π Version & Regression Information
- This changed between versions 4.1.5 and 4.2-beta
β― Playground Link
Playground link with relevant code
π» Code
enum Enum {
A,
B,
C,
}
interface Interface<T extends Enum> {
type: T;
}
function foo<T extends Enum>(x: Interface<T>) { }
// this no longer works as of 4.2
function bar(x: Interface<Enum.A | Enum.B> | Interface<Enum.C>) {
foo(x);
}
// but this works?
function baz(x: Interface<0 | 1> | Interface<2>) {
foo(x);
}
π Actual behavior
Emits an error.
π Expected behavior
Should not error.