TS Config
tsconfig.json
{
// some other settings
"compilerOptions": {
// some other options
"strictNullChecks": true,
"strictPropertyInitialization": true,
"noImplicitAny": true,
}
}
strictNullChecks
- see Typestarget
-module
- This is the version of Javascript that our code will get compiled to- ex. if we set
module
tocommonjs
, then the Typescript will be compiled into Javascript usingrequire
andmodule.exports
syntax. - server-side project that uses Node.js should probably use CJS, while front-end applications should probably use ESM
- ex. if we set
target
- This setting changes which JS features are downleveled and which are left intact.- ex.
() => this
will be turned into an equivalent function expression if target is ES5 or lower. target
also changes the default value oflib
.
- ex.