Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type circularly referencing itself when using a generic union type #39734

Closed
ClementNerma opened this issue Jul 24, 2020 · 2 comments
Closed
Labels
Duplicate An existing issue was already created

Comments

@ClementNerma
Copy link

TypeScript Version: 3.9.2, 4.0.0-beta.20200724, nightly

Search Terms: generic union type circularly referencing itself

Code

class A<T> {}
class B<T> {}

type A_or_B<T> = A<T> | B<T>

type C = A<C> | B<C> // Works fine
type D = A_or_B<D> // Doesn't work :(

Expected behavior:

The code should compile.

Actual behavior:

It does not.

Playground Link: https://www.typescriptlang.org/play/#code/FAYwNghgzlAECCAeAKgPlgbwL6kjWAQiutsMAC4CeADgKYID6A9gE4NFqwC8CxsAPoWJkqdWAGFuvcekFEZsAPSLYAdVYBrOADMAlgDtaFGvQAiU+MzZFT6ZbFNNaUfQHJysAO6bYALgAUwEA

Related Issues: -

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Jun 7, 2021
@RyanCavanaugh
Copy link
Member

Duplicate #41164 (comment); others

@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants