5 lines
3.0 KiB
JSON

{
"id": "guide/strict-mode",
"title": "Strict mode",
"contents": "\n\n\n<div class=\"github-links\">\n <a href=\"https://github.com/angular/angular/edit/master/aio/content/guide/strict-mode.md?message=docs%3A%20describe%20your%20change...\" aria-label=\"Suggest Edits\" title=\"Suggest Edits\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">mode_edit</i></a>\n</div>\n\n\n<div class=\"content\">\n <h1 id=\"strict-mode\">Strict mode<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"guide/strict-mode#strict-mode\"><i class=\"material-icons\">link</i></a></h1>\n<p>When you create a new workspace or an application you have an option to create them in a strict mode using the <code>--strict</code> flag.</p>\n<p>Enabling this flag initializes your new workspace or application with a few new settings that improve maintainability, help you catch bugs ahead of time.\nAdditionally, applications that use these stricter settings are easier to statically analyze, which can help the <code>ng update</code> command refactor code more safely and precisely when you are updating to future versions of Angular.</p>\n<p>Specifically, the <code>strict</code> flag does the following:</p>\n<ul>\n<li>Enables <a href=\"https://www.typescriptlang.org/tsconfig#strict\"><code>strict</code> mode in TypeScript</a>, as well as other strictness flags recommended by the TypeScript team. Specifically, <code>forceConsistentCasingInFileNames</code>, <code>noImplicitReturns</code>, <code>noFallthroughCasesInSwitch</code>.</li>\n<li>Turns on strict Angular compiler flags <a href=\"guide/angular-compiler-options#stricttemplates\"><code>strictTemplates</code></a>, <a href=\"guide/angular-compiler-options#strictinjectionparameters\"><code>strictInjectionParameters</code></a> and <a href=\"guide/template-typecheck#troubleshooting-template-errors\"><code>strictInputAccessModifiers</code></a>.</li>\n<li><a href=\"guide/build#configuring-size-budgets\">Bundle size budgets</a> have been reduced by ~75%.</li>\n</ul>\n<p>You can apply these settings at the workspace and project level.</p>\n<p>To create a new workspace and application using the strict mode, run the following command:</p>\n<code-example language=\"sh\" class=\"code-shell\">\n\nng new [project-name] --strict\n\n</code-example>\n<p>To create a new application in the strict mode within an existing non-strict workspace, run the following command:</p>\n<code-example language=\"sh\" class=\"code-shell\">\n\nng generate application [project-name] --strict\n\n</code-example>\n\n \n</div>\n\n<!-- links to this doc:\n-->\n<!-- links from this doc:\n - guide/angular-compiler-options#strictinjectionparameters\n - guide/angular-compiler-options#stricttemplates\n - guide/build#configuring-size-budgets\n - guide/strict-mode#strict-mode\n - guide/template-typecheck#troubleshooting-template-errors\n - https://github.com/angular/angular/edit/master/aio/content/guide/strict-mode.md?message=docs%3A%20describe%20your%20change...\n - https://www.typescriptlang.org/tsconfig#strict\n-->"
}