Skip to content

Key in mapped variadic tuple should not be literal after the variadic partΒ #48856

Closed
@Josh-Cena

Description

@Josh-Cena

Bug Report

πŸ”Ž Search Terms

Variadic tuple mapped type keyof

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

type Keys<O extends unknown[]> = { [K in keyof O]: K };

type A = Keys<[string, ...string[]]>;
type B = Keys<[string, ...string[], number]>;

πŸ™ Actual behavior

A and B both have the variadic part typed as ..."1"[], which is wrong. B is further wrong because the number part becomes "2", while in practice it would rarely be "2".

πŸ™‚ Expected behavior

A should be ["0", ...number[]]; B should be ["0", ...number[], number]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fix AvailableA PR has been opened for this issueWorking as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions