When you create a new workspace or an application you have an option to create them in a strict mode using the
Enabling this flag initializes your new workspace or application with a few new settings that improve maintainability, help you catch bugs ahead of time. Additionally, applications that use these stricter settings are easier to statically analyze, which can help the
ng update command refactor code more safely and precisely when you are updating to future versions of Angular.
strict flag does the following:
- Enables strict mode in TypeScript, as well as other strictness flags recommended by the TypeScript team. Specifically,
- Turns on strict Angular compiler flags strictTemplates, strictInjectionParameters and strictInputAccessModifiers.
- Bundle size budgets have been reduced by ~75%.
You can apply these settings at the workspace and project level.
To create a new workspace and application using the strict mode, run the following command:
ng new [project-name] --strict
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
© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.