News for hackers. Stuff that matters.
Re:How an Anti-TypeScript “JavaScript developer” like me bec... by lmm on Tuesday March 02, 2021 @08:35PM (#26323635)
Typescript permits you to write code that does implicit unsafe casts at runtime. Type-safe languages don't. Java Generics don't let you implicitly do unsafe casts[1]; erased generics mean the unsafe cast wouldn't necessarily fail visibly at runtime (though there are warnings and linters to alert you to that, and techniques to work around it), but it would enforce that it was explicit in the code (and you would then know to add extra test coverage etc.).

[1] You can implicitly do unsafe casts using arrays, but arrays aren't really using generics, they're a special-case builtin.

There are no comments on this comment yet.