Skip to content

Redeclaring 'let' by 'var' or 'var' by 'let' is an error according to ES6 spec, should be a TS compiler error #1910

Closed
@zhuravlikjb

Description

@zhuravlikjb

https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-early-errors
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-early-errors

  • It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList also occurs in the VarDeclaredNames of StatementList.
function do_something() {
    let foo;
    var foo; // it should be an error
}

Seems that it should be a TS compiler error, too.

p.s.: By the way, Visual Studio's JS editor properly highlights it as an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions