Skip to content

fix(38295): Duplicated object key in const not detected when the key is a number preceded by - or + #38607

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

Merged
merged 2 commits into from
May 20, 2020

Conversation

a-tarasyuk
Copy link
Contributor

Fixes #38295

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The positive case is more complicated than the current implementation.

!!! error TS2300: Duplicate identifier '[-1]'.
}

const c = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be an error; at least on node it's fine:

> { "+1": 1, [+1]: 2 }
{ '1': 2, '+1': 1 }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this case should instead be "1"/[+1] and also 1/[+1].

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sandersn Thanks for the feedback

@sandersn sandersn added the For Backlog Bug PRs that fix a backlog bug label May 19, 2020
@sandersn sandersn self-assigned this May 20, 2020
@sandersn sandersn merged commit 3340142 into microsoft:master May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Duplicated object key in const not detected when the key is a number preceded by - or +
2 participants