You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constX='x'enumY{ONE='one',TWO='one'}// static key - 'duplicate identifier' errorconstobj1={'y': 'wham','y': 'bam'// as expected, tsc error `Duplicate identifier ''y''`}constobj2={y: 'wham',y: 'bam'// as expected, tsc error `Duplicate identifier 'y'`}// [the bug] dynamic key - no 'duplicate identifier' errorconstobj3={[X]: 'wham',[X]: 'bam'// no tsc error!}constobj4={[Y.ONE]: 'wham',[Y.TWO]: 'bam'// no tsc error!}
Expected behavior:
When assigning duplicate dynamic keys to plain objects, which can be statically inferred (e.g. enums or const with primitive type) - tsc should show a compilation error.
TypeScript Version: 3.1.0-dev.20180809
Search Terms: dynamic key duplicate identifier
Code
Expected behavior:
When assigning duplicate dynamic keys to plain objects, which can be statically inferred (e.g.
enum
s orconst
with primitive type) - tsc should show a compilation error.Actual behavior:
no compilation error.
Playground Link:
a long long long playground link ...
Related Issues: N/A
The text was updated successfully, but these errors were encountered: