Skip to content

keyof does not include well known symbols #24622

Closed
@mgroenhoff

Description

@mgroenhoff

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFix AvailableA PR has been opened for this issueFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions