Is there a JavaScript syntax that lets me do the following more succinctly?
class MyClass {
static get myProp() {
return 1;
}
}
It is not a huge deal, but I'd like to know if there was something that was like an arrow function that lets me make it just a little more streamlined, something like:
class MyClass {
static get myProp = () => 1;
}
I know I could write it like this (though not a safe equivalent):
class MyClass {}
MyClass.myProp = 1;
Or this more-difficult-to-read and longer alternative:
class MyClass {}
Object.define(MyClass, 'myProp', { get: () => 1; });
But that feels like an abuse of the class
syntax.