Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keyof does not include well known symbols #24622

Closed
mgroenhoff opened this issue Jun 2, 2018 · 5 comments · Fixed by #42543
Closed

keyof does not include well known symbols #24622

mgroenhoff opened this issue Jun 2, 2018 · 5 comments · Fixed by #42543
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue Fixed A PR has been merged for this issue
Milestone

Comments

@mgroenhoff
Copy link

TypeScript Version: 2.9.1

Search Terms:
keyof well known symbol

Code

const s = Symbol("s");

interface I {
    n: number;
    [s]: string;
    [Symbol.iterator](): IterableIterator<[string, string]>;
}

type K = keyof I;
type T = I[K];

Expected behavior:

type K = keyof I; // type K = typeof s | "n" | typeof Symbol.iterator
type T = I[K]; // type T = string | number | () => IterableIterator<[string, string]>

Actual behavior:

type K = keyof I; // type K = typeof s | "n"
type T = I[K]; // type T = string | number
@mhegazy
Copy link
Contributor

mhegazy commented Jun 4, 2018

Predicated on #21603

@mhegazy mhegazy added the Bug A bug in TypeScript label Jun 4, 2018
@mhegazy mhegazy added this to the TypeScript 3.0 milestone Jun 4, 2018
@weswigham
Copy link
Member

@mhegazy we're going to need an LKG post-lib references to stage this change. We probably also want to have a forked copy of the node @types definitions which uses lib references for our own build until we ship the feature and can push the change to DT.

@weswigham
Copy link
Member

@RyanCavanaugh if we want this in 3.1, we need to look into taking #24738

@bluenote10
Copy link

This feature would significantly simplify writing generic wrappers needed in Solid. See this SO question for an explanation of the use case in Solid. Looking forward to a release.

CC @ryansolid

@jcalz
Copy link
Contributor

jcalz commented Nov 11, 2019

Another relevant SO question.

Could we remove the "fixed" tag from this issue since it means the same thing as the less-confusing "fix available"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue Fixed A PR has been merged for this issue
Projects
None yet
7 participants