5 ms·
TypeScript is good as a language. You can't generate static binaries out of it (except Docker images) and that itself is a deal breaker.
by ashishb 1y ago
TypeScript is good as a language. You can't generate static binaries out of it (except Docker images) and that itself is a deal breaker.
- genshii 1y agoYeah, that's definitely a huge drawback. Bun lets you get pretty close though with the `--compile` flag: https://bun.sh/docs/bundler https://bun.sh/docs/bundler Too bad the binaries are 60MB at a minimum :(
- Tade0 1y agoI mean you can, they're just inappropriately large.
- wk_end 1y agoI'd love to see someone develop a compiler for TypeScript that got, say, Ocaml-like performance. There's a bunch of reasons why that'd be tough though - you'd probably want a language very-similar-to-but-not-quite-like-TypeScript.
- ellg 1y agoits called C#
- wk_end 1y agoC# is a lovely language but it's not that similar to TypeScript. The big distinction (for me) is that it's nominally-typed and much more rigid. Unless things have changed a lot since I last touched it (admittedly a while ago): You can't synthesize ad hoc union types (https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types https://www.typescriptlang.org/docs/handbook/2/everyday-type...) There's no notion of literal types (https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types https://www.typescriptlang.org/docs/handbook/2/everyday-type...) There's no type narrowing (which gets you a kind of sum type) (https://www.typescriptlang.org/docs/handbook/2/narrowing.html https://www.typescriptlang.org/docs/handbook/2/narrowing.htm...) Most of the type maniuplation features (keyof, indexed access types, conditional types, template literal types...) are missing (https://www.typescriptlang.org/docs/handbook/2/types-from-types.html https://www.typescriptlang.org/docs/handbook/2/types-from-ty...)
- pragmatic 1y agoClose but not quite.
- williamstein 1y agoThis is probably the closest thing to that: https://www.assemblyscript.org/ https://www.assemblyscript.org/
- wk_end 1y agoThe documentation is really incomplete. It's not at all clear how similar to TypeScript this is...does this support structural subtyping? Type manipulation? Iterators/generators? Async?
- abhijat 1y agoThere used to be reasonml but I'm not sure how active it is these days.
- wk_end 1y agoReasonML is just OCaml with a different syntax. It sort of very loosely resembles JS syntactically in that it's got curly braces, but that's about as far as the similarities go - about as much as Rust resembles C. The type system and language are very different from TypeScript or JS, and much more rigid.
- skybrian 1y agoYou can’t? I haven’t used it, but what’s wrong with “deno compile?” https://docs.deno.com/runtime/reference/cli/compile/ https://docs.deno.com/runtime/reference/cli/compile/
- shim__ 1y agoSounds like electron but for cli
- chainwax 1y agoI does indeed bundle it's runtime into the executable, but this is not dissimilar from Go bundling it's gc into every executable. Granted a compiled hello world Go program will be <2mb while a similar compiled Deno program will be more like 70. I imagine many usecases may not have a storage constraint though, and in that case why not?
- ashishb 1y agoMy problem is running post install step of 100+ npm packages on my machine. Any of those could be malicious. https://www.sentinelone.com/blog/unseen-threats-in-software-development-the-perils-of-trojanized-npm-packages/ https://www.sentinelone.com/blog/unseen-threats-in-software-...
- ashishb 1y agoYou are the fifth person who told me that this can be done but have never used it. If this compile approach is so awesome why don't devs use it?