Closed
Description
Bug Report
π Version & Regression Information
ts stable & nightly
β― 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