Since ES6 classes are tagged as structs, you cannot access computed properties/methods:
var test = Symbol('test');
class Foo {
[test]() {}
}
var f = new Foo;
f[test]();
This fails with:
input0:6: WARNING - Cannot do '[]' access on a struct
f[test]();
^
0 error(s), 1 warning(s), 89.8% typed
Repo case:
http://closure-compiler-debugger.appspot.com/#input0%3Dvar%2520test%2520%253D%2520Symbol('test')%253B%250Aclass%2520Foo%2520%257B%250A%2520%2520%255Btest%255D()%2520%257B%257D%250A%257D%250Avar%2520f%2520%253D%2520new%2520Foo%253B%250Af%255Btest%255D()%253B%250A%26input1%26conformanceConfig%26externs%26refasterjs-template%26includeDefaultExterns%3D1%26CHECK_SYMBOLS%3D1%26CHECK_TYPES%3D1%26LANG_IN_IS_ES6%3D1%26MISSING_PROPERTIES%3D1%26PRESERVE_TYPE_ANNOTATIONS%3D1%26PRETTY_PRINT%3D1%26TRANSPILE%3D1
You can annotate the class with @unrestricted to use computed properties.
Most helpful comment
You can annotate the class with
@unrestrictedto use computed properties.