News for hackers. Stuff that matters.
Re:Bonsai: Janestreet's UI Library by vips7L on Monday August 03, 2026 @12:30PM (#49157980)
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.
Re:Bonsai: Janestreet's UI Library by gleenn on Monday August 03, 2026 @02:49PM (#49159877)
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.
Re:Bonsai: Janestreet's UI Library by warpech on Monday August 03, 2026 @03:00PM (#49160010)
Compiling TypeScript is just stripping out types
Re:Bonsai: Janestreet's UI Library by Stratoscope on Monday August 03, 2026 @03:38PM (#49160420)
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.

Re:Bonsai: Janestreet's UI Library by igl on Monday August 03, 2026 @04:16PM (#49160865)
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
Re:Bonsai: Janestreet's UI Library by Stratoscope on Monday August 03, 2026 @05:29PM (#49161691)
Thanks for the correction! It was a long time ago that I used TypeScript, and making things worse (for my memory) it was an Angular project.

So today, most people and teams avoid the parts of TS that require compilation into different JS, and --erasableSyntaxOnly lets you enforce this, right?

Re:Bonsai: Janestreet's UI Library by igl on Monday August 03, 2026 @06:00PM (#49162045)
Exactly. There is plenty of code change however introduced by bundlers who do “bundling“, polyfill injection, minification, this kind of stuff.
Re:Bonsai: Janestreet's UI Library by p_l on Monday August 03, 2026 @04:16PM (#49160852)
"fortunately" we can load swc compiled to wasm to deal with that.
Re:Bonsai: Janestreet's UI Library by hermanradtke on Monday August 03, 2026 @03:58PM (#49160657)
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.

Re:Bonsai: Janestreet's UI Library by Stratoscope on Monday August 03, 2026 @05:24PM (#49161638)
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.

Re:Bonsai: Janestreet's UI Library by gleenn on Monday August 03, 2026 @06:15PM (#49162171)
Isn't that like saying the Internet is only written in English if you strip out all the non-English. All C-style languages are fully cross compatible if you only use semicolons.

I can't write Typescript into a browser without cross-compilation and "stripping out types" involves parsing and manipulating code. That's a different language.

Re:Bonsai: Janestreet's UI Library by jitl on Monday August 03, 2026 @10:14PM (#49163684)
No. 98% of typescript specific syntax can be replaced with U+0020 SPACE to yield runnable JavaScript. The runtime semantics of the two languages are congruent. the same cannot be said for any other language im aware of.
Re:Bonsai: Janestreet's UI Library by gleenn on Tuesday August 04, 2026 @01:48AM (#49164718)
I'm sorry but if you need a transpiler to get it to run in a browser, character replacability and runtime semantics don't matter. Typescript doesn't run in the browser, it's obviously a different language.
Re:Bonsai: Janestreet's UI Library by vips7L on Monday August 03, 2026 @06:16PM (#49162182)
Except TS has much wider community support. The type definitions/wrappers are already written.
Re:Bonsai: Janestreet's UI Library by balencpp on Monday August 03, 2026 @09:11PM (#49163311)
Doesn't apply as much to Clojurescript due to it being dynamically typed and its flexibility. Sure, you often write a wrapper, but it's more of an abstraction and a good practice, not a necessity in cljs.
Re:Bonsai: Janestreet's UI Library by sysguest on Tuesday August 04, 2026 @03:02AM (#49165177)
"due to it being dynamically typed"

hmm ok nope