microsoft / microsoft/TypeScript

Duplicate keys do not error

Open
#59,396 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

🔎 Search Terms
🕗 Version & Regression Information
  • This is a crash
  • This changed between versions latest and latest_
  • This changed in commit or PR _______
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _______
⏯ Playground Link

No response

💻 Code
export const func = (demo: string) => {
    const obj = {
        [demo]: '1',
        [demo]: '1',
    };
    console.log(obj);
};
🙁 Actual behavior

no error
image

🙂 Expected behavior

error

Additional information about the issue

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue provides only an inline TypeScript snippet and no repository file or test. Start by reproducing the computed-property example in the TypeScript compiler or Playground, then trace the diagnostic and object-literal checking entry points. Done means establishing whether this construct should produce an error and adding or updating a regression test for the agreed behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.