Skip to content

ES6 validator doesn't understand static class methods #629

@AshleyScirra

Description

@AshleyScirra

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.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugjavascriptJavaScript support issuesupstreamIssue identified as 'upstream' component related (exists outside of VS Code)

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions