upvote
KotlinJs and ClojureJs too. You always end up having to write wrappers or dealing with problems that would just work if you just used normal js/ts.
reply
Clojurescript not ClojureJs, and Typescript doesn't run in the browser, it has the exact same issues/limitations: it must be compiled to JavaScript first.
reply
Compiling TypeScript is just stripping out types
reply
That is true only if you confine your TS code to be pure JS plus type annotations.

There are TS constructs that require compilation into equivalent JS, such as enums and namespaces.

reply
Are there any other?

Namespaces are heavily discouraged. Some teams still use enigma but most people in the know us unions of strings.

I know the TS team regrets enums and I have not seen any plans for adding additional keywords that break type stripping.

reply
The other one I read about was parameter properties in constructors.

And thank you for the correction! It was quite a few years ago that I used TypeScript, and I think the landscape was different then.

Making things even fuzzier in my mind, this was an Angular project, and it was hard to keep track of what was Angular and what was TypeScript.

It sounds like people these days actively avoid the parts of TypeScript that require translation into different JS code.

reply
"fortunately" we can load swc compiled to wasm to deal with that.
reply
absolutely nobody used those outside of a language demo. We also got --erasableSyntaxOnly last year to remove them from the language. The TS team considers them “mistakes“ for a really long time now
reply
Yup, and Clojure/ClojureScript!
reply
Couldn't WASM solve that problem once and for all? Is there some limitation that WASM has that JS doesn't?

Disclaimer: I am very inexperienced at front-end development.

reply
> Is there some limitation that WASM has that JS doesn't?

You need a JS trampoline to call your WASM and make browser primitives available to it, and IIRC calls into browser code incur some extra overhead, but those are pretty manageable.

Additionally: for high level languages, source code is _much_ smaller than compiled binaries. If your initial needs are simple, your users are likely downloading more than 10x as much code.

reply
WASM does not (yet) have access to the DOM or web APIs, meaning every direct interaction with the browser must first go through JS interop anyways, with a resulting performance penalty. There are proposals, and maybe we'll see it happen by 2035, but as of now WASM is best suited for heavier workloads where the edge in application performance outweighs the cost of JS interop with the browser rather than being a universal solution.
reply
Such attempts are quite common. Some I remember:

https://ocsigen.org/ in Ocaml too

https://websharper.com/ for fsharp and csharp. Really good when I used in in fsharp

Maybe https://melange.re/v7.0.1/ too? (Not sure)

reply
I took this as a joke in reference to the popularity of JavaScript on the backend for the last two decades.
reply
that's because most people's intro to CS was how to build a webpage.
reply
Modern web development is more like computer alchemy
reply