jsynowiec's comments

jsynowiec | 9 years ago | on: Show HN: Boilerplate for Node.js and TypeScript with Jest tests

Re 1: This is not a problem with TypeScript, but with Node. It's the same with every to-js-transpiled language. You can use https://github.com/evanw/node-source-map-support to get stack traces for your TS sources.

Re 2: I do agree that this is a problem but remember that it's all just a community effort. You can always create your own type definitions or enhance existing ones and share on the DefinitelyTyped repository. Also, most of the time if a type definition is out of date or invalid, you can just create your own partial typedef for a module with only those several methods you are actually using.

Re 3: IMO it's a feature. By using, for e.g. a bluebird library to wrap third party code in a Promise, you are changing the way how your code is interacting with that library by redeclaring the whole library or some parts of it. TSC is complaining because you've changed the declarations. You have to provide your own type definitions, either inline, or for the whole module.

I've engineered or reviewed several projects that are using TypeScript with success. The teams after initial hiccups are mostly not willing to come back to pure JavaScript now.

I'm not advocating to use TS everywhere and for every project. It all depends. Many factors must be considered but some sort of type checking is usually a good thing to have.

jsynowiec | 9 years ago | on: Show HN: Boilerplate for Node.js and TypeScript with Jest tests

Exactly. TSC usually complains on all stubs, mocks and spies or it takes massive amounts of time to properly annotate the types. Unit tests quickly don't follow AAA rule, are hard to read (and understand) and the required time investment is not worth it. I find using TypeScript for source code and JavaScript for unit tests much more convenient.

jsynowiec | 9 years ago | on: Show HN: Boilerplate for Node.js and TypeScript with Jest tests

I'm using both TypeScript and Flowtype for my projects, hence the second boilerplate repository on GitHub: https://github.com/jsynowiec/node-flowtype-boilerplate

Usually I tend to lean towards TypeScript due to:

- Much better tooling and editor/IDE integration (I'm using vscode and WebStorm),

- DefinitelyTyped repository and the availability of type definitions,

- It's subjective but TS has better documentation and examples,

Don't get me wrong, the Flow (and React) community is doing a great job and in my opinion Flow is a very good tool for static type checking. The real problem with both is the coverage/quality of type definitions and the amount of time it takes to create typedefs. Right now there are many more typedefs available for TypeScript and the community is stronger and more active.

Also, right now one common format or conversion between definition formats is not possible, see: https://twitter.com/lbljeffmo/status/787692583350829056

page 1