TypeScript Configuration Options
Explore the TypeScript configuration options by examining the tsconfig.json file settings. Learn how to specify files to compile, adjust compiler behavior, manage module lookups, and enable strict type-checking options. This lesson helps you understand how configuration impacts code validation and compiler output, preparing you to fine-tune your TypeScript projects for better reliability and maintainability.
We'll cover the following...
We now have all the tools we need to discuss the TypeScript configuration.
tsconfig.json file
Here’s our tsconfig.json file, which controls the configuration of our compiler:
The configuration file has two main purposes:
- Specifying the list of files to compile
- Specifying the behavior of the compiler itself
We can specify the files using a files property that takes a list of files to compile. Or, we can use include and exclude properties. If you don’t have files or an include, like our project, the default behavior is to compile any .ts or .tsx files that are not on the exclude list.
Both include and exclude can be made of explicit file names, or we can use patterns with ? to match a single character, * to match any characters except directory ...