This article requires you to have at least some TypeScript knowledge. Topics like ReturnTypePartial, Generics <T> , intersections, how to modify the global namespace, and the tsc command line will be covered. All the while focusing on using the type of safety that TypeScript offers.

Let’s begin with establishing a baseline on a couple of things.

Running vs developing

This statement is something I’d wished someone had been more specific on when starting to learn TypeScript. _Writing _the code and _running _the code is two very different things. TypeScript only exists while developing and what’s _really _running is plain JavaScript. This makes debugging harder and using types while in runtime is impossible (except for the ones supported by vanilla JavaScript).

tsconfig.json recommendations

Keep the settings as tight as possible and let TypeScript shine. This _especially _includes noImplicitAny: true and strictNullChecks: true . Keeping the settings tight seem annoying at times, but for the long run — they’re a winning concept. Fewer bugs, better IntelliSense, and refactoring becomes a walk in the park.

Target

There is a number of variations on target , se documentation at  https://www.typescriptlang.org/tsconfig/#target. For backend development, there’s no need to consider browser compatibility. Just use the latest and greatest features.

#typescript #coding #javascript

The Guide to Kickstarting Backend TypeScript Development
1.10 GEEK