Category : strict

import { Component, OnInit, ViewChild } from ‘@angular/core’; import {Subject} from ‘rxjs’; import {debounceTime} from ‘rxjs/operators’; import {NgbAlert} from ‘@ng-bootstrap/ng-bootstrap’; @Component({ selector: ‘app-root’, templateUrl: ‘./app.component.html’, styleUrls: [‘./app.component.css’] }) export class AppComponent implements OnInit { staticAlertClose=false; successMesage=”; private _success = new Subject<string>(); @ViewChild(‘staticAlert’, {static: false}) staticAlert: NgbAlert; @ViewChild(‘selfClosingAlert’, {static: false}) selfClosingAlert: NgbAlert; ngOnInit(): void { //throw ..

Read more

I have am trying to upgrade a library to version 11, strict mode. The code can be found here works when strict is not enforced and in prior version of angular. https://stackblitz.com/edit/angular-ivy-fsnmjo?file=src%2Fapp%2Fmodel%2Fmember.ts. I have defined a method in the Member class to determine if 2 objects are "equal". In my application, a member is equal ..

Read more

Tour of heroes tutorial on Angular website is not written to follow all the recommended strict modes. So declaring a property like this is usual practice: @Input() employee: Employee; But in strict mode the eslint problem is this: Type error: Property ’employee’ has no initializer and is not definitely assigned in the constructor So I ..

Read more

I upgraded my app from Angular v10 to v11 and now I get multiple errors and warnings because some (maybe all) fields can be undefined in a time: for example: const savedToken = new Token(JSON.parse(localStorage.getItem(AuthInterceptor.tokenKey))); must become: const savedToken = new Token(JSON.parse(<string>localStorage.getItem(AuthInterceptor.tokenKey))); warning: Argument of type ‘string | null’ is not assignable to parameter of ..

Read more

With Angular in strict mode, I have an error that I cannot resolve with FormBuilder… The app checks for an ip with : Code for saisie.component.ts : import { Component, OnInit } from ‘@angular/core’; import { FormGroup, Validators, FormBuilder } from ‘@angular/forms’; @Component({ selector: ‘app-saisie’, templateUrl: ‘./saisie.component.html’, styleUrls: [‘./saisie.component.scss’] }) export class SaisieComponent implements OnInit ..

Read more

Description IN angular 10, below is my ts-config. { "compileOnSave": false, "compilerOptions": { "baseUrl": "./", "outDir": "./dist/out-tsc", "forceConsistentCasingInFileNames": true, "strict": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "sourceMap": true, "declaration": false, "downlevelIteration": true, "experimentalDecorators": true, "moduleResolution": "node", "importHelpers": true, "target": "es2015", "module": "es2020", "lib": [ "es2018", "dom" ] }, "angularCompilerOptions": { "strictInjectionParameters": true, "strictTemplates": true } } ..

Read more

Description IN angular 10, below is my ts-config. { “compileOnSave”: false, “compilerOptions”: { “baseUrl”: “./”, “outDir”: “./dist/out-tsc”, “forceConsistentCasingInFileNames”: true, “strict”: true, “noImplicitReturns”: true, “noFallthroughCasesInSwitch”: true, “sourceMap”: true, “declaration”: false, “downlevelIteration”: true, “experimentalDecorators”: true, “moduleResolution”: “node”, “importHelpers”: true, “target”: “es2015”, “module”: “es2020”, “lib”: [ “es2018”, “dom” ] }, “angularCompilerOptions”: { “strictInjectionParameters”: true, “strictTemplates”: true } } ..

Read more