Skip to content

tsserver signals TS7017 incorrectly when using a symbol-indexed property #29536

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

Open
argv-minus-one opened this issue Jan 23, 2019 · 1 comment
Labels
Bug A bug in TypeScript Domain: TSServer Issues related to the TSServer
Milestone

Comments

@argv-minus-one
Copy link

When declaring a symbol-indexed property on an existing interface, attempting to use it gives error TS7017 in VSCode. tsc, however, compiles it without complaint, implying a bug in tsserver.

TypeScript Version: 3.3.0-dev.20190119

Search Terms: TS7017 tsserver symbol property

Code

const additionalProp = Symbol();

interface Document {
	[additionalProp]?: number;
}

document[additionalProp] = 42; // TS7017 in tsserver/vscode (but not tsc)
console.log(document[additionalProp]); // same

tsconfig.json:

{
"compilerOptions": {
	"strict": true,
	"charset": "UTF-8",
	"target": "es6",
	"module": "es6",
	"lib": ["es6", "dom"]
}
}

Expected behavior:

The above code does not have any error highlights.

Actual behavior:

There is an error highlight. The hover says: “Element implicitly has an 'any' type because 'Document' has no index signature. ts (7017)”

Playground Link — The Playground also shows the incorrect error highlight.

Related Issues: None, as far as I can tell.

@argv-minus-one
Copy link
Author

@weswigham weswigham added Bug A bug in TypeScript Domain: TSServer Issues related to the TSServer labels Jan 23, 2019
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Mar 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: TSServer Issues related to the TSServer
Projects
None yet
Development

No branches or pull requests

3 participants