Hacker News new | past | comments | ask | show | jobs | submit login

> Types

There are so many better options if you want a good type system (Elm, PureScript, Rescript, GHCjs, Scala.js, and many more). TypeScript is unsound, and necessarily by it's design, it has to take on weird issues to maintain compatibility with JavaScript (null/undefined, can run effect anywhere, a lot of codebases are filled with any types). Heck, TypeScript doesn't even come with ADTs and proper pattern matching.




> There are so many better options if you want a good type system

I am looking for basic type checking to prevent me from doing stupid things and catching bugs at "compiletime" instead of runtime.

Typescript interfaces with their structural typing do the job just fine.

I think people are underestimating the power of ecosystem. I use JS daily. Deno allows me to use it on the server as well without doing crazy things.

You have been able to do something similar in Java for a very long time with Mozilla Rhino (and now GraalJs) but without the same level of comfort and convenience.


> TypeScript doesn't even come with ADTs

You still can use them [0].

> proper pattern matching

[1] is pretty good.

[0] https://itnext.io/practical-introduction-to-algebraic-dataty...

[1] https://github.com/gvergnaud/ts-pattern


They need to be first-class. Not means the ergonomics aren't great and it won't be the developer default because it requires a library. It's not good enough considering how fundamental these two are in many languages (it's even in Java now)


Similarly: https://www.assemblyscript.org/

> A TypeScript-like language for WebAssembly.

> AssemblyScript targets WebAssembly's feature set specifically, giving developers low-level control over their code.

> Being a variant of TypeScript makes it easy to compile to WebAssembly without learning a new language.

> Integrates with the existing Web ecosystem - no heavy toolchains to set up. Simply npm install it!


So TypeScript is designed for the internet, and languages with good type systems are not.


This has nothing to do with the GP's comment, which was about local scripting (replacing "shell scripts and Java")


Typescript definitely has some flaws but it also has some really powerful features that aren't found in any other type systems, like the ones you listed.

And in any case I don't think anyone is really saying "Use Deno because it has static type annotations". It's "Use Deno because it has static type annotations and is fast and easy to deploy and has a huge ecosystem and doesn't require a project setup file to use third party libraries and ..."




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: