Closed
Description
Bug Report
🔎 Search Terms
duplicate string identifiers
duplicate keys in object
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about duplicate/keys/properties
- In the playground 3.3.3 doesn't have any support for duplicate keys and 3.5.1 has support for ids but this bug exists
⏯ Playground Link
Playground link with relevant code
💻 Code
const bar = "bar";
const a = {
["foo"]: 1,
["foo"]: 2, // Error
[bar]: 3,
[bar]: 4, // Not Error
};
🙁 Actual behavior
The second instance of bar
is allowed.
🙂 Expected behavior
The second instance of bar
as an input should not be allowed.
Additional
When you introduce bar
as a key in any other form it causes the error I would expect with just the variables.
Playground link to this scenario
const bar = "bar";
const a = {
["foo"]: 1,
["foo"]: 2, // Error
[bar]: 3,
[bar]: 4, // Error
bar: 5, // Error
};