Hacker News new | ask | show | jobs
by smt88 2803 days ago
TypeScript supports Flow-like type annotation in comments, which allows you to take advantage of static type-checking without transpiling.

That's as much as I know about it. I don't use that feature because transpiling is such a minor issue that I can't imagine any universe in which I would use comment-style types, which are slightly more cumbersome to use.

1 comments

That feature is for JS files. It helps you convert your JS project into flow/TS in a piecewise manner. Otherwise you'll have to do a major rewrite in a very short amount of time.
> Otherwise you'll have to do a major rewrite in a very short amount of time.

This just isn't true. TS was designed from the beginning to allow gradually adding types. Whether transpiling or using comments, you can change one file at a time.

Indeed -- interop works _very_ well.