Re:JavaScript libraries should be written in TypeScript
by robert_tweed on Wednesday March 16, 2016 @10:58AM
(#11297816)
The problem is with the author's assertion that all libraries should be using TypeScript and not, say, Flow, or some other alternative that achieves the same goals, perhaps better.
[ Parent
| on HN ]
Re:JavaScript libraries should be written in TypeScript
by MadcapJake on Wednesday March 16, 2016 @11:17AM
(#11297981)
Does Flow offer type definition files?
Re:JavaScript libraries should be written in TypeScript
by AgentME on Wednesday March 16, 2016 @04:19PM
(#11300366)
Yes. Also, there isn't a need to maintain a separate definitions file[1] if the library was developed as Flow-typed code. I've made a few small libraries[2] that were written with Flow-typed code, and are built so that the types are automatically enforced if you use the library in a Flow-typed project.
[1] A hand-maintained definitions file: https://github.com/facebook/immutable-js/blob/master/type-de... . Sure, it's nice as documentation, but that is a lot of redundant effort if you already have separate documentation, and types and documentation in the original source code too. [2] https://github.com/AgentME/contain-by-screen is one simple example.