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

Add rule to detect duplicate (computed) properties #344

Open
ajafff opened this issue Jul 18, 2018 · 1 comment
Open

Add rule to detect duplicate (computed) properties #344

ajafff opened this issue Jul 18, 2018 · 1 comment

Comments

@ajafff
Copy link
Member

ajafff commented Jul 18, 2018

const A = 'a';
const x = {[A]: 1, [A]: 2}; // duplicate property 'a'
const y = {a: 1, [A]: 2}; // duplicate property 'a'
const z = {[A]: 1, a: 2} // duplicate property 'a'

The compiler doesn't emit an error here. See microsoft/TypeScript#25758

This can probably be merged with no-duplicate-spread-property to a more general no-duplicate-property rule. Maybe this is already checked, but only on object literals that contain object spread.

@ajafff
Copy link
Member Author

ajafff commented Jul 18, 2018

Turns out this is in fact already checked by no-duplicate-spread-property for object literals that contain object spread. So this simply needs to check more object literals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant