TypeScript - TS configuration

One to Rule Them All

There is one file that defines how strictly TypeScript will analyze your code. The tsconfig.json requires a proper setup and options for your project to be safely checked.

You will need to understand the core options and their default values to avoid making mistakes that may later require a lot of work to fix.

Strictness

I know that I can adjust how strictly TypeScript checks the code

I am aware of the recommended setup, which includes strict, exactOptionalPropertyTypes, and forceConsistentCasingInFileNames options

I also understand how to modify the strictness of external libraries using the skipLibCheck

Extending available types

I know that I can add additional type sources using the typeRoots configuration or use include with .d.ts files

I understand that this approach should be used for unsupported out-of-the-box imports, such as .css or libraries without @types packages

Scope

I know that I can define which files will be checked and included inside the build using various options inside the tsconfig.json

I can use a combination of include, exclude, and files to specify which items will be considered as source code. I also understand that I can adjust the resolution of absolute imports with baseUrl, paths, and rootDir(s)

Compatibility

I know that there are built-in options that allow me to adjust TypeScript compatibility with JSON files, pure JavaScript, JSX format, and decorators

I also understand that I can use some plugins to extend supported code, with for example, GraphQL and SQL syntax

Reusability

I know that I can create a base configuration and then use it to extend or reference it in the newly created tsconfig.json

Icon of TypeScript
Icon of TS configuration
TypeScript skill
suggested
TS configuration
Ready to learn
Required technologies

I know that I can adjust how strictly TypeScript checks the code

I am aware of the recommended setup, which includes strict, exactOptionalPropertyTypes, and forceConsistentCasingInFileNames options

I also understand how to modify the strictness of external libraries using the skipLibCheck

I know that I can add additional type sources using the typeRoots configuration or use include with .d.ts files

I understand that this approach should be used for unsupported out-of-the-box imports, such as .css or libraries without @types packages

I know that I can define which files will be checked and included inside the build using various options inside the tsconfig.json

I can use a combination of include, exclude, and files to specify which items will be considered as source code. I also understand that I can adjust the resolution of absolute imports with baseUrl, paths, and rootDir(s)

I know that there are built-in options that allow me to adjust TypeScript compatibility with JSON files, pure JavaScript, JSX format, and decorators

I also understand that I can use some plugins to extend supported code, with for example, GraphQL and SQL syntax

I know that I can create a base configuration and then use it to extend or reference it in the newly created tsconfig.json

Close
Loading content