Skip to content

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

Closed
@guncha

Description

@guncha

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.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions