Member-only story

Creating a TypeScript tsconfig for nodejs

Learn how to easily setup a tsconfig file to build for nodejs.

Ben Force
1 min readMar 31, 2021

Do you hate dealing with tsconfig files? My problem is that I just don’t spend enough time with them to learn all the settings. I create the config once for a new project, usually leaving most things as default, then never touch it again.

Fortunately, I recently discovered that Microsoft has created a collection of platform-specific presets to base your tsconfig on. The preset is installed as an npm package and referenced using theextendsproperty in your tsconfig.

To setup a typescript project for node 14 install the@tsconfig/node14preset.

npm install --save-dev @tsconfig/node14

Now your tsconfig can be as simple as one property, but any settings in your tsconfig will override the preset values.

{
"extends": "@tsconfig/node14/tsconfig.json"
}

The power behind the extends property is that you can easily get started on a project with optimized settings, and if you have multiple TypeScript projects you can create your own tsconfig preset!

References

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Ben Force
Ben Force

Written by Ben Force

I am a 5x AWS certified senior full-stack developer. I write about cloud architecture, infrastructure as code, and automation.

No responses yet

Write a response