Skip to content

any | T from conditional type does not reduce to any  #52568

@dragomirtitian

Description

@dragomirtitian

Bug Report

🔎 Search Terms

any union

🕗 Version & Regression Information

  • This changed between versions 5.0.0-dev.20221207 and 5.0.0-dev.20221208

⏯ Playground Link

Playground link with relevant code

💻 Code

type Spec = any extends object ? any : string;

type WithSpec<T extends number> = T

type R = WithSpec<Spec> // error here  in 5.0

🙁 Actual behavior

Spec is any | string so it can't be used with WithSpec

🙂 Expected behavior

any | string is reduced to any as it was in 4.9

Metadata

Metadata

Assignees

Labels

Domain: Conditional TypesThe issue relates to conditional typesEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Fix AvailableA PR has been opened for this issueHelp WantedYou can do this

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions