As of v12, strict mode is the default, so you don't have to opt in anymore. This commit removes the instructions to add --strict to the ng new. PR Close #41542
1.6 KiB
Strict mode
Angular CLI creates all new workspaces and projects with strict mode enabled.
Strict mode improves maintainability and helps you catch bugs ahead of time.
Additionally, strict mode applications are easier to statically analyze and can help the ng update command refactor code more safely and precisely when you are updating to future versions of Angular.
Specifically, strict mode does the following:
- Enables
strictmode in TypeScript, as well as other strictness flags recommended by the TypeScript team. Specifically,forceConsistentCasingInFileNames,noImplicitReturns,noFallthroughCasesInSwitch. - Turns on strict Angular compiler flags
strictTemplates,strictInjectionParametersandstrictInputAccessModifiers. - Bundle size budgets have been reduced by ~75%.
You can apply these settings at the workspace and project level.
Using the basic ng new command to create a new workspace and application automatically uses strict mode, as in the following command:
ng new [project-name]
To create a new application in the strict mode within an existing non-strict workspace, run the following command:
ng generate application [project-name] --strict