Skip to content

mapped type with remapped keys unexpectedly widens type #57265

Description

@rotu

🔎 Search Terms

keyof, string, record

🕗 Version & Regression Information

  • This changed between versions 4.4.4 and 4.5.5

⏯ Playground Link

No response

💻 Code

typeR={[KinkeyofRecord<string,unknown>asK]: unknown;};// ^?typeK=keyofR;// ^?lets:string="a"asK

Workbench Repro

🙁 Actual behavior

keyof R is string | number.

🙂 Expected behavior

keyof R is string.

Additional information about the issue

No response

Metadata

Metadata

Labels

Has ReproThis issue has compiler-backed repros: https://aka.ms/ts-reprosNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions