Playground JSDoc type annotations

JSDoc type annotations used to work in the playground, but no longer seem to (to enable typing in the js playground).

I’m guessing this is a Monaco thing? Though setting the language to javascript here and pasting in the function from the pg seems to work how it should (i.e. hovering over gives the correct types, not any as in the pg).

It probably worked a long time ago. We are supporting typescript in the playground, and it is the main language used. As TypeScript is a superset of JavaScript, we didn’t change the parser to both. Try using typescript annotations in javascript and you will see what I am referring to.

You can ask why doesn’t the playground use javascript features directly instead of typescript, i don’t have a good answer :slight_smile: We can investigate it and see how complicated it would be to use JS-features instead of TS in the JS playground.

Yeah it was probably 2019 sometime that I last tried to use JSDoc comments in the playground.

I saw the quick fix suggestions to use add typescript types (which I’d love to do; I’ve used ts over js almost exclusively since ~2016) based on the JSDoc comment, and while the syntax is accepted by the editor, it fails to run (see pg).

Should the typescript playground be made the default then? I’ve mainly not used it in the past as I’m not a fan of the visual clutter of wrapping the createScene function in a class (and I can’t really see any benefits of doing so). Could it not just be the same the js playground but with types?

I’ve also noticed (sorry not trying to make a list of issues here, just haven’t used the pg much for a year or so, so noticing some changes now) that page closes or reloads, or switching from js to ts, aren’t intercepted by default after edits have been made, as safe mode is disabled until toggled on. Should this not be set to true by default?

Thanks for your help. I can do prs if needed on some of the changes above if they’re agreed to.