Re:Rust is a hard way to make a web API
by WClayFerguson on Sunday January 17, 2021 @12:11PM
(#25812441)
You can go into my 250,000 loc project and randomly pick any variable name, method name, parameter name, etc., and put a typo in it or wrong type, and the compiler will catch it.
I have 100% type safety, and it's all done by TypeScript and my programming language IS TypeScript (not JS)
The the final output format generated by a compiler has absolutely nothing to do with whether the Language being compiled is typesafe or not. That would be like saying since Bytecode is not typesafe therefore Java is not a type safe language.
Re:Rust is a hard way to make a web API
by 29athrowaway on Sunday January 17, 2021 @08:55PM
(#25817332)
TypeScript is not the only way to achieve that.
Google closure compiler and JetBrains IDEs can use JSdoc to validate types. I have used those to a reasonable level of accuracy to document entire JavaScript projects where I cannot migrate to TypeScript.
Re:Rust is a hard way to make a web API
by WClayFerguson on Sunday January 17, 2021 @10:59PM
(#25817955)
Excellent. Rock on man. I never thought I'd be a Microsoft fan again, but after they invented TypeScript/VSCode, I love them so much I might move to Redmond.
Does TypeScript forbid using JavaScript features? no.
Can TypeScript realistically verify that your program is type-safe? no.
Is TypeScript 100% type-safe? no. They wanted fast adoption, therefore they allowed JavaScript and untyped variables.