TS1117

error TS1117: An object literal cannot have multiple properties with the same name in strict mode.

Broken Code ❌

1
2
3
4
const objectLiteral = {
name: 'Benny',
name: 'Sofia'
};

Fixed Code ✔️

We can only have one value per property:

1
2
3
const objectLiteral = {
name: 'Benny'
};