Skip to content

inferred generic incorrectly widenedΒ #43736

@DetachHead

Description

@DetachHead

Bug Report

πŸ”Ž Search Terms

inferred generic widened

πŸ•— Version & Regression Information

4.3.0-beta

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

type Foo<T extends number> = T extends infer R? Bar<R>: never //compile error: Type 'R' does not satisfy the constraint 'number'

type Bar<T extends number> = never

πŸ™ Actual behavior

R was incorrectly widened to no longer be a number, even though it was inferred from T which is a number

πŸ™‚ Expected behavior

no error, as R is a number

Metadata

Metadata

Assignees

No one assigned

    Labels

    In DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions