Skip to content

Type is not narrowed when inferring number-like stringΒ #48635

@graphemecluster

Description

@graphemecluster

Bug Report

Is this working as intended?

πŸ”Ž Search Terms

infer with extends

πŸ•— Version & Regression Information

New feature in 4.7.0

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

type foo = "42" extends `${infer T extends number}` ? T : never

πŸ™ Actual behavior

Type of foo is inferred as number.

πŸ™‚ Expected behavior

Type of foo is inferred as 42.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions