Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turning off Strict Mode in Angular?

Tags:

I'm running into this issue and I'd like to turn off strict mode to get around it.

I've modified tsconfig.json with:

"compilerOptions": {
  "strict": false,

And also tried:

 "compilerOptions": {
   "noImplicitUseStrict": true,

But no love. Thoughts?

like image 730
Ole Avatar asked Aug 20 '19 03:08

Ole


People also ask

How do I turn off strict mode in Angular 10?

Disable strict checks entirely by setting strictTemplates: false in the application's TypeScript configuration file, tsconfig. json. Disable certain type-checking operations individually, while maintaining strictness in other aspects, by setting a strictness flag to false.

How do I disable TypeScript strict mode?

You can do that by compiling with the --noImplicitUseStrict compiler option—add "noImplicitUseStrict": true to "compilerOptions" in tsconfig. json. Doing so will prevent the compiler from emitting "use strict" .

What is strict mode in Angular?

Strict modelink 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.

What is strict mode in TypeScript?

TypeScript strict mode is a bunch of TypeScript compiler parameters (that can be also be represented by one “main” parameter) that make TypeScript compiler tsc force you to follow specific rules of writing code in TypeScript. All these rules are directly related to types and managing types in the TypeScript code.


1 Answers

Following Angular doc, the strict mode can be disabled turning off these flags on tsconfig.json file:

   "forceConsistentCasingInFileNames": false,
   "strict": false,
   "noImplicitReturns": false,
   "noFallthroughCasesInSwitch": false,
   ...
   "angularCompilerOptions": {
      "strictInjectionParameters": false,
      "strictInputAccessModifiers": false,
      "strictTemplates": false
   }
like image 158
Sangarllo Avatar answered Sep 18 '22 01:09

Sangarllo