Skip to content

Incorrect index signature parameter type error #18759

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

Closed
mbrodersen opened this issue Sep 26, 2017 · 1 comment
Closed

Incorrect index signature parameter type error #18759

mbrodersen opened this issue Sep 26, 2017 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@mbrodersen
Copy link

Version

$ ./node_modules/typescript/bin/tsc --version
Version 2.4.2

Code

type ClientId = number;

interface Clients {[key:ClientId]:any};

Expected behavior

No compiler errors.

Actual behavior

error TS1023: An index signature parameter type must be 'string' or 'number'.

Comment

ClientId is a number and Typescript is using structural typing - not nominative typing.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Sep 26, 2017
@RyanCavanaugh
Copy link
Member

Duplicate #14934 and many others

@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants