Angular CLI Strict Mode

Angular CLI Strict Mode

In Angular 10 we announced a strict opt-in mode that allows us to perform more build-time optimizations and help you deliver faster apps with fewer defects. To opt into the strict mode, you need to create a new Angular CLI app, specifying the --strict flag

In Angular, we strongly believe in consistency and best practices. For example, we adopted TypeScript in its early days because we wanted all developers using the framework to take advantage of compile-time type checking. This way, we enabled an excellent development experience for everyone with better editor support, allowing people to ship apps with fewer issues.

In Angular v10 we announced a strict opt-in mode that allows us to perform more build-time optimizations and help you deliver faster apps with fewer defects. This mode is still only an opt-in because it comes with its trade-offs — stricter type checking and extra configuration. We want to hear from you which of these trade-offs will make you more productive and allow you to deliver better apps.

Image for post

Opting in to Strict Mode

To opt into the strict mode, you need to create a new Angular CLI app, specifying the --strict flag:

ng new my-app --strict

The command above will generate a workspace with the following settings enabled on top of the defaults:

  • Strict mode in TypeScript, as well as other strictness flags recommended by the TypeScript team. Specifically, strict, forceConsistentCasingInFileNames, noImplicitReturns, noFallthroughCasesInSwitch
  • Turns on strict Angular compiler flags strictTemplates and strictInjectionParameters
  • Reduced bundle size budgets by ~75%
  • Turns on no-any TSLint rule to prevent declarations of type any
  • Marks your application as side-effect free to enable more advanced tree-shaking

Let us look at each one of these in detail.

web-development angular typescript javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Angular Web Application Development

Skenix Infotech is a top-notch Angular development company providing customized AngularJS development services. Hire reliable & expert Angular developers from us.

TypeScript Tutorial For JavaScript Developers - TypeScript Basics

TypeScript Tutorial For JavaScript Developers - TypeScript Basics. I will show you guys 4 example of JavaScript code, and how to convert it to TypeScript. This is a typescript beginners tutorial.

CRM Application | Angular Development | App Development

47% of corporations have 90% ready-made CRM adoption rate as it helps startups, SMEs, big brands in managing data, business relationships & grow business.