Skip to content

Type Parameter Union RegressionΒ #42932

Closed
@osyrisrblx

Description

@osyrisrblx

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.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions