When generating a new application using the Angular CLI we can pass --strict flag to turn on strict template type checking and strict TypeScript checking.
It would be good to have this option available when using the Nx Angular Application and Library schematics too.
For example, this would add the following in an Angular CLI application:
tsconfig.base.json
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true, // enable strict type checking
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"module": "es2020",
"lib": [
"es2018",
"dom"
]
},
"angularCompilerOptions": { // Add strict template checks
"strictInjectionParameters": true,
"strictTemplates": true
}
}
Stricter type safety can be very useful especially in large enterprise applications. It would also be good to have parity with the @angular/cli generate schematic for this feature.
ng generate @nrwl/angular:application my-app --strict
Library support as well perhaps?
ng generate @nrwl/angular:library my-lib --strict
Thanks 馃槉
It would be great if it were also possible to execute create-nx-workspace with a strict flag
Most helpful comment
It would be great if it were also possible to execute
create-nx-workspacewith astrictflag