Strict Compiler Options
The TypeScript compiler uses the tsconfig.json
file to specify a number of compilation options. These options include what version of JavaScript we would like to generate for, what the output directory should be, and whether or not to allow JavaScript source files within the project directory. We have already discussed a few of these compiler options on our journey with TypeScript so far.
One of the most important options is simply named strict
, and this single option turns on a group of other compiler options. The purpose of the strict compiler options is to apply a number of checks to our code and determine whether any of these checks fail. As an example, these strict options can determine if a variable could be undefined at the time of use, or if the variable itself is never used. If we set the value of the strict option to false, or turn it off, then each of these options needs to be turned on individually. In this chapter, we will explore these other...