google / google/closure-compiler

Numbers and string literals not allowed as property names

Open
#1,851 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

The spec says string literals and numeric literals should be allowed as property names in class definitions, but the compiler won't allow it.
https://tc39.github.io/ecma262/#prod-LiteralPropertyName

https://closure-compiler-debugger.appspot.com/#input0%3Dclass%2520Foo%2520%257B%250A%2520%2520'hello'()%2520%257B%2520return%2520'hello'%253B%2520%257D%250A%257D%26input1%26conformanceConfig%26externs%26refasterjs-template%26includeDefaultExterns%3D1%26CHECK_SYMBOLS%3D1%26CHECK_TYPES%3D1%26CLOSURE_PASS%3D1%26LANG_IN_IS_ES6%3D1%26MISSING_PROPERTIES%3D1%26PRESERVE_TYPE_ANNOTATIONS%3D1%26PRETTY_PRINT%3D1%26TRANSPILE%3D1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.