Playground incorrectly highlights static initialization block as a syntax error. It still runs correctly, though.
Maybe this is a false alarm. Babylon TypeScript targets ES2021 (see this thread) and static initialization block is not supported until v8.dev and ES2022.
So while current browsers support the static initialization block (see this mdn web docs page), the current version of JavaScript that BABYLON TypeScript targets is ES2021, so it’s not completely unreasonable that static initialization blocks are not fully supported in the playground.
I did a short dive into the monoco editor github where javascript is defined. Turns out it is checked for syntax using the typescript “interpreter” with definitions of keywords (including “set” and “get”). I found where (syntax) markers are evaluated near line 344 _convertDiagnostics().
I didn’t identify exactly what would need to change to not highlight static initialization blocks. And I don’t know what version of monoco is being used in the playground.
If the playground were updated to recognize static initialization blocks, it would help me out, but I can’t fully make that recommended update until Babylon is compiled to ES2022 or later.
cc @RaananW
There is a plan to revamp the typescript support, but yes, this will not be supported until we update the target. A bit (or a lot) of patience and changing the target will be supported in the playground