#

Property 'id' has no initializer and is not definitely assigned in the constructor.ts(2564)
 
Fehlermeldung

Property 'id' has no initializer and is not definitely assigned in the constructor.ts(2564)

 
Vorkommen: in der Angular compontent.ts datei wird eine lokale Variable in Typescript erstellt
Lokale Variable in component.ts

id: number;


 
Lösung 1:
Variable nullable machen mit ! Ausrufezeichen

id!: number;


 
Lösung 2:
Variable anhängen beim start

id: number ;


 
Global Solution
Add the following line in tsconfig.json

"strictPropertyInitialization": false,//*added


 
Fehler in Visual Code angezeigt

Ein Bild, das Text, Monitor, Screenshot enthält. Automatisch generierte Beschreibung

 
 
In tsconfig.json
Ein Bild, das Text enthält. Automatisch generierte Beschreibung
Mobile

.

yesmovies