xxxxxxxxxx
Remove strictProperinitialization
xxxxxxxxxx
//inside tsconfig.json file
"angularCompilerOptions": {
// ...
"strictPropertyInitialization": false
// ...
}
xxxxxxxxxx
// tsconfig.json
"compilerOptions": {
// ...
"strictPropertyInitialization": false,
// ...
}
// OR
@Component({ })
export class Component {
@Input() myInput: string|undefined;
}
// OR
@Component({ })
export class Component {
@Input() myInput!: string;
}
xxxxxxxxxx
Just go to tsconfig.json and set
"strictPropertyInitialization": false
to get rid of the compilation error.
Otherwise you need to initialize all your variables which is a little bit annoying
xxxxxxxxxx
"strictPropertyInitialization": false
xxxxxxxxxx
{
"compilerOptions": {
.
"noImplicitReturns": false,
.
"strictPropertyInitialization": false
},
"angularCompilerOptions": {
}
}
xxxxxxxxxx
// Go to tsconfig.json and set this to true.
strictPropertyInitialization : true
xxxxxxxxxx
strictPropertyInitialization flag in typescript compiler options in tsconfig.json file.
"compilerOptions": {
///
,
"strictPropertyInitialization":false
}
xxxxxxxxxx
// Go to tsconfig.json and set this to false;
strictPropertyInitialization : false;
xxxxxxxxxx
@Component({ })
export class Component {
@Input() myInput: string|undefined;
}
OR
@Component({ })
export class Component {
@Input() myInput!: string;
}