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

Type indexing with string literals starting with __ does not work #14268

Closed
guncha opened this issue Feb 23, 2017 · 2 comments
Closed

Type indexing with string literals starting with __ does not work #14268

guncha opened this issue Feb 23, 2017 · 2 comments
Assignees
Labels
Bug A bug in TypeScript

Comments

@guncha
Copy link

guncha commented Feb 23, 2017

TypeScript Version: 2.3.0-dev.20170223

Code

It's very likely that this is already reported, but I couldn't find it after a quick search through the issues.

type Foo = {
  bar: string
  __typename: string
}

type A = Foo["bar"] // ok 
type B = Foo["__typename"] // Property '__typename' does not exist on type 'Foo'.

Expected behavior:

Type B should be string.

Actual behavior:

Error is thrown.

@guncha
Copy link
Author

guncha commented Feb 23, 2017

I did find an older similar issue: #8614

Lo and behold:

type B = Foo["___typename"] // three underscores, ok

@mhegazy mhegazy added the Bug A bug in TypeScript label Feb 23, 2017
@mhegazy mhegazy added this to the TypeScript 2.3 milestone Feb 23, 2017
gcanti added a commit to gcanti/fp-ts that referenced this issue Mar 25, 2017
@weswigham
Copy link
Member

This should be fixed by #16915

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants