I'm using angular framework and here is my class structure:
export class Demo {
_name: string;
constructor(inputName: string) {
this.name = inputName;
}
public set name(inputName: string) {
this._name = `%${inputName}%`;
}
public get name(): string {
return this._name;
}
}
And it give me an error:
Property '_name' has no initializer and is not definitely assigned in the constructor.
How can I prevent it?