Skip to content

Strict mode

Rule

You can check this option in your tsconfig.json file :

{
  "compilerOptions": {
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noImplicitOverride": true,
    "noPropertyAccessFromIndexSignature": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true
  },
  "angularCompilerOptions": {
    "strictInjectionParameters": true,
    "strictInputAccessModifiers": true,
    "strictTemplates": true
  }
}

Angular will verify the following items :

  • Embedded views (such as those within an *ngIf or *ngFor) are checked
  • Pipes have the correct return type
  • Local references to directives and pipes have the correct type (except for any generic parameters, which will be any)
  • Verifies that component/directive bindings are assignable to their @Input()
  • Obeys TypeScript's strictNullChecks flag when validating the preceding mode
  • Infers the correct type of components/directives, including generics
  • Infers template context types where configured (for example, allowing correct type-checking of NgFor)
  • Infers the correct type of $event in component/directive, DOM, and animation event bindings
  • Infers the correct type of local references to DOM elements, based on the tag name (for example, the type that document.createElement would return for that tag)