Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ajafff opened this issue Dec 23, 2018 · 1 comment
Labels
Bug A bug in TypeScript
Milestone

Comments

@ajafff
Copy link
Contributor

ajafff commented Dec 23, 2018

TypeScript Version: 3.3.0-dev.20181222

Search Terms:

Code

Taken from the tests added in #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

@weswigham weswigham added the Bug A bug in TypeScript label Dec 25, 2018
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Mar 14, 2019
@ajafff
Copy link
Contributor Author

ajafff commented Feb 3, 2020

This is partially fixed in master. Although it needs target: ESNext and useDefineForClassFields: true to work.

This may be a positive side-effect of the latest work by @sandersn in that area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants