Skip to content

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

Closed
@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