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
moduletocommonjs, then the Typescript will be compiled into Javascript usingrequireandmodule.exportssyntax. - 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.
() => thiswill be turned into an equivalent function expression if target is ES5 or lower. targetalso changes the default value oflib.
- ex.