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

Numeric enums as key types in mapped types #31784

Merged
merged 6 commits into from
Jun 6, 2019
Merged

Conversation

ahejlsberg
Copy link
Member

This PR fixes a minor issue related to numeric enums as key types in mapped types. We now generate a numeric index signature when a numeric enum type occurs in the key type of a mapped type. Previously we wouldn't generate anything which was inconsistent.

The PR also fixes a crash that is triggered by the following code:

declare enum E { ONE, TWO, THREE = 'x' }
const e: E = E.ONE;
const x: E.ONE = e;

Fixes #31771.

@ahejlsberg ahejlsberg requested a review from weswigham June 6, 2019 16:44
@ahejlsberg ahejlsberg merged commit 4ae3a54 into master Jun 6, 2019
@ahejlsberg ahejlsberg deleted the numericEnumMappedType branch June 6, 2019 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Index signature error for mapped type when keyed on declare enum
2 participants