Property ‘…’ has no initializer and is not definitely assigned in the constructor

stuck with this compilation error for a while. Suppose we have this property defined;

public result = Result

If we want to initialize above property only, we can write it like this;

public result! = Result

Second alternative is to open sconfig.json and set

"compilerOptions": {
    "strictPropertyInitialization": false,
    ...
}

This will be a project wide change and you don’t need to initialize all your variables.

https://stackoverflow.com/questions/49699067/property-has-no-initializer-and-is-not-definitely-assigned-in-the-construc

FavoriteLoadingAdd to favorites

RECENT POSTS


Categories



Tags

ADO ai angular asian asp.net asp.net core azure ACA azure administration Azure Cloud Architect Azure Key Vault Azure Storage Blazor WebAssembly BLOB bootstrap Branch and Release flow c# c#; ef core css datatables design pattern docker excel framework Git guide HTML JavaScript jQuery json knockout lab LINQ linux powershell REST API smart home SQL Agent SQL server SSIS SSL SVG Icon visual studio Web API window os wordpress


ARCHIVE


DISCLAIMER