-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
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.
noahwillcrow and OverHash
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue