Skip to content

proposal:rest infer #26246

Closed
Closed
@kgtkr

Description

@kgtkr

Search Terms

Generics

Suggestion

Decomposition of tuple type

Examples

type Hoge<T extends any[]> = T extends [infer X, ...infer XS] ? X | Hoge<XS> : never;

There is a problem of #14174

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript / JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. new expression-level syntax)

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