DEV Community

Cover image for It's raining TsConfigs
Giuliano1993
Giuliano1993

Posted on

It's raining TsConfigs

Good morning everyone and happy MonDEV!☕
How was this past weekend?

Today I want to get straight to the point and dive into the heart of the topic!
How many of you use TypeScript? Personally, I am among the fans and, although I recognize that it is not ideal for every project, I always try to use it whenever possible.
A part that can often be a bit tricky, especially when starting to get familiar with the language, is the tsconfig file, which, if not set correctly, can lead to unexpected results when switching from TS to JS. I have experienced this on several occasions both with the make-js-component command and with the related VS Code extension, both clearly developed in TypeScript. In both cases, the correct configuration of TypeScript has proven to be a crucial point in their development.

To better understand this file and to have a good starting point, on this page of the totallytypescript blog, you will find an ideal tsconfig, with some comments indicating some parts that may need to be kept in some cases or removed in others. Everything is explained in a very clear and immediate way and you will have no problems bringing it into your project. However, a complete explanation follows the full version of the file, which will allow you to better understand, option by option, what is happening and therefore intervene more precisely.

If, however, you want to have a tsconfig tailored specifically for your project, you cannot miss the tsconfig/bases repository, a collection of configurations designed specifically for certain types of projects, among which it is very easy to find yours. Among the various configs designed specifically for various versions of notes, for Vite, or React Native, or Nuxt... you have really a lot of choices and if you don't find what suits you, you can always start from one of the existing ones and create one more suitable... and then maybe make a PR!
Each config can be imported into the project directly with npm install, a matter of seconds and you will be ready to run your TypeScript watcher!

Today's resource was a quick one, I hope it is useful to those of you who use or want to learn TypeScript. As always let me know if you found it useful and/or interesting!
In the meantime, I wish you all a good start to the week!
Happy Coding 0_1

Top comments (0)