TypeScript in NodeJS

Posted by Joe Enos on December 29, 2020 · 1 min read

It doesn't take much to set up TypeScript in NodeJS. TypeScript's type safety makes it much more enjoyable to write than plain JavaScript.

If you're new to TypeScript, check out the playground where you can see a bunch of examples of what TypeScript looks like compared to JavaScript.

When importing NPM packages, you can almost always find the typings by installing @types/my-package-name. If that doesn't work, do a web search and you'll most likely find a blog post or StackOverflow answer that tells you how to use the package with TypeScript.

View code on GitHub