microsoft / microsoft/TypeScript
`keyof Readonly<string[]>` different from `keyof Readonly<T>` where T is string[]
Open
@ahejlsberg is already working on this.
Since Oct 16, 2024.
Needs Investigation
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.4k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
🔎 Search Terms
keyof Readonly array
🕗 Version & Regression Information
Latest to date
⏯ Playground Link
💻 Code
type T1 = Readonly<string[]>; // readonly string[]
type R1 = keyof T1; // keyof readonly string[]
type KeyOfReadonly<T> = keyof Readonly<T>;
type R2 = KeyOfReadonly<string[]>; // ❌ keyof string[]
🙁 Actual behavior
doesn't work
🙂 Expected behavior
works
Additional information about the issue
What can I say, I really hope this is not the intended behavior.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.