Skip to content

ES6 validator doesn't understand static class methods #629

Closed

Description

The following code is valid ES6 code:

(function ()
{
    class C {
        static Foo()
        {
            console.log("Foo");
        }
    };
})();

(jsconfig.json must specify the "ES6" target to understand the class syntax)

VS code underlines "static" in red and says "Modifiers cannot appear here". This is an incorrect error: it is valid ES6 syntax.

Note VS Code does not mark it as an error if the class is not wrapped in an IIFE, but these are typically used for encapsulation.

Activity

  1. added
    bug
    javascript
    on Nov 26, 2015
  2. added
    upstream
    on Dec 10, 2015
  3. jrieken commented on Dec 10, 2015

    @jrieken
    Contributor

    This comes from the version of TypeScript we are using behind the scenes. Will be fixed once we use project salsa.

  4. castlerek commented on Jan 13, 2016

    @castlerek

    +1 the same

  5. ronnieoverby commented on Jan 19, 2016

    @ronnieoverby

    +1. I guess this is Salsa? microsoft/TypeScript#4789

  6. jrieken commented on Jan 19, 2016

    @jrieken
    Contributor

    Yes - that Salsa it is. We plan to ship the Jan release with a sneak peak of it and make it GA for Feb

  7. jrieken commented on Mar 16, 2016

    @jrieken
    Contributor

    As we now ship with project Salsa this should work.

  8. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugjavascriptupstream

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions