microsoft / microsoft/TypeScript

missing 'used before declaration' error within computed name of accessor or method

Open
#29,137 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Domain: Binder
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TypeScript Version: 3.3.0-dev.20181222

Search Terms:

Code

Taken from the tests added in https://github.com/Microsoft/TypeScript/pull/29136

class D {
    static A = class extends D.B {
        [D.D]() {} // should be an error
    }
    static B = class {}
    static C = {
        [D.D]: 1,
        ...{get [D.D]() {return 0;}} // should be an error
    };
    static D = '';

    [foo]() {} // should have an error
} 

let bar = {
    [foo]() {} // should have an error
}
let foo = 1;

Expected behavior:

The lines marked with // should be an error should have an error.

Actual behavior:

Currently there's no error at all. After #29136 lands the lines with the comments are missing an error.

Playground Link: https://agentcooper.github.io/typescript-play/#code/MYGwhgzhAEAi0G8BQ1XQgFzBglsaAgtALzSiQwCmAHhpQHYAmMsAdAEKIpo8DabsALoAKAJSIAvtAD009AAsA9gFcQjaACNK0MPWiUATgcUHuqCWfRZc+TqXJRJlzNjzQAwiS48+AwQC5oAEYAGkseVkiEAHNKDGh+ViExRAM45QM9AAYAbgkpWQUVNU1tXX0jE0sJHOdrN3hSAHIm2qkgA

Related Issues: #29135

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

Start by reviewing the tests added in pull request #29136 and the related issue #29135, then reproduce the example with the reported TypeScript version or the Playground link. Done means the marked computed-name cases produce the expected “used before declaration” errors, including accessor and method names.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.