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

> supports but ignores type annotations

That’s how TS works too though - compilation just strips the types via babel etc, with type checking a separate process. You opt in file by file by switching .js to .ts




Well, the nice thing with Python types is that the _only_ difference to untyped Python is the type annotations. Last time I worked with TypeScript (two and a half years ago), it felt more like a different language _similar_ to JS. In my experience it was quite... viral. With MyPy I've genuinely seen just specific parts of a code base become typed and didn't notice any friction.

I wonder what would happen if that proposal for type comments in JS went through. Would TypeScript become just a type checker / optimizing compiler?

Google's Closure had an (IMHO) nicer approach (using doc comments for type annotations, see: https://github.com/google/closure-compiler/wiki/Types-in-the...), but I don't get the impression it'll ever catch on outside Google.


Closure team have also deprecated a lot of the old tooling. Closue was ahead of it's time for sure and as someone who heavily used the Closure Library and Closure compiler in advanced mode, it is sad that it did not catch on. However using TSickle you can transpile Typescript into javascript which closure compiler uses for advanced optimisations.




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

Search: