0

This application was originally written in Angular 6 but has been upgraded to Angular 13 - Actually had to create Angular 13 project and then add all the code files components, templates, etc. In the tsconfig.json, which looks like:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "forceConsistentCasingInFileNames": true,
    "strict": false, //true
    "noImplicitOverride": false, //true
    "noPropertyAccessFromIndexSignature": true,
    "noImplicitReturns": false,//true
    "noFallthroughCasesInSwitch": true,
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2017",
    "module": "es2020",
    "lib": [
      "es2020",
      "dom"
    ]
  },
  "angularCompilerOptions": {
    "enableI18nLegacyMessageIdFormat": false,
    "strictInjectionParameters": true,
    "strictInputAccessModifiers": true,
    "strictTemplates": true
  }
}

Three of the elements namely strict, noImplicitOverride, noImplicitReturns I had to set to false to make it work. After I had success in compiling the application, now I'm trying to set it back to strict: true and working through the errors. I cannot figure out how to initialize

public formGroup: FormGroup;

since it is an object, I tried to use new, but that doesn't help

It is using "typescript": "~4.6.2" Please advise

P.S. There are many such errors, so just wondering if setting strict as true is a good idea or not Please advise

SilverFish
  • 1,014
  • 6
  • 28
  • 65
  • Is that just a declaration? If so, try `formGroup!: FormGrouo` (notice the exclamation mark) – julianobrasil May 11 '23 at 21:36
  • Does this answer your question? [Property '...' has no initializer and is not definitely assigned in the constructor](https://stackoverflow.com/questions/49699067/property-has-no-initializer-and-is-not-definitely-assigned-in-the-construc) – Yong Shun May 12 '23 at 00:17

0 Answers0