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

Issues indexing with unique symbols on generic types #22320

Closed
DanielRosenwasser opened this issue Mar 4, 2018 · 1 comment
Closed

Issues indexing with unique symbols on generic types #22320

DanielRosenwasser opened this issue Mar 4, 2018 · 1 comment
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Mar 4, 2018

Found helping @bterlson with something.

Basically, the main issue is that as soon as I use an indexed access type with a unique symbol on a type parameter, things fall apart.

declare const fooProp: unique symbol;

export interface Foo<T> {
  [fooProp]: T
}

function f<T extends Foo<any>>(x: T) {
    const abc = x[fooProp] // expected: 'T[typeof fooProp]'; actual: 'any'

    /**
     * Expected: no error
     * Actual: Type 'unique symbol' cannot be used to index type 'T'.
     */
    const def: T[typeof fooProp] = x[fooProp]
}
@DanielRosenwasser DanielRosenwasser added the Bug A bug in TypeScript label Mar 4, 2018
@yortus
Copy link
Contributor

yortus commented Mar 4, 2018

The second problem looks the same as #21912.

@mhegazy mhegazy added this to the TypeScript 2.8 milestone Mar 5, 2018
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Mar 5, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants