Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Fixes 'keyof T' type example#941

Closed
aleph-naught2tog wants to merge 1 commit intomicrosoft:masterfrom
aleph-naught2tog:string-index-types
Closed

Fixes 'keyof T' type example#941
aleph-naught2tog wants to merge 1 commit intomicrosoft:masterfrom
aleph-naught2tog:string-index-types

Conversation

@aleph-naught2tog
Copy link
Copy Markdown

Fixes #29249 from the TypeScript repository

@guillaumep
Copy link
Copy Markdown
Contributor

guillaumep commented Jan 4, 2019

@aleph-naught2tog Actually TypeScript type as (string | number)[] and not string[].

This atypical result would certainly require some explanation (it confuses me a lot).

@DanielRosenwasser
Copy link
Copy Markdown
Member

The explanation is that because string index signatures implicitly handle indexing with numbers, keyof also returns number in the output type.

@aleph-naught2tog
Copy link
Copy Markdown
Author

@DanielRosenwasser I think I'm confused; which is the correct typing then? I had read the issue as being that it wasn't string[] so the fix was to make it that, but I can totally change it 😁

@RyanCavanaugh
Copy link
Copy Markdown
Member

Thank you for contributing to the TypeScript Handbook!

We are currently working through a large backlog of open PRs. As part of this, we're asking authors of PRs with active merge conflicts to assess if their changes are still needed, and if so, open a new PR.

For transparency, we are also working on a full-scale reimagining of the Handbook (see the TypeScript Roadmap), meaning we are largely closing down work on the current version of the Handbook. Typo fixes are always appreciated, but any new content should likely wait until the new Handbook is available so that it can be more naturally adapted to that format.

@tommck
Copy link
Copy Markdown

tommck commented Jul 17, 2019

So... it's been 5 months... still not updating the old content? Do we have an ETA on the new handbook?

@orta
Copy link
Copy Markdown
Contributor

orta commented Jul 18, 2019

I just merged a PR like this, so the fix will appear in the new site on the next deploy

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants