Bug Report
🕗 Version & Regression Information
ts stable & nightly
⏯ Playground Link
Playground Link
💻 Code
const x = {
[1]: 2,
[1]: 2,
// ^^^ ERROR: An object literal cannot have multiple properties with the same name. (1117)
};
enum Enum { foo = 1, }
const y = {
[Enum.foo]: 2,
[Enum.foo]: 2,
// ^^^^^^^^^^ No Error
};
🙁 Actual behavior
Defining an object literal with duplicate keys throws an error for literal 1 but not for enum member Enum.foo
🙂 Expected behavior
Defining an object with duplicate keys from enum members throws an error
[Enum.foo]: 2,
[Enum.foo]: 2,
// ^^^^^^^^^^ An object literal cannot have multiple properties with the same name
Bug Report
🕗 Version & Regression Information
ts stable & nightly
⏯ Playground Link
Playground Link
💻 Code
🙁 Actual behavior
Defining an object literal with duplicate keys throws an error for literal
1but not for enum memberEnum.foo🙂 Expected behavior
Defining an object with duplicate keys from enum members throws an error