I need some help on this one.
My goal is to create a class C_GenericTask for which I can change its properties. One of those properties is an enum E_TaskState with the following properties: TODO, DOING and DONE.
But when I try to use the setter of the C_GenericTask, typescript is throwing this error :
TS2349: This expression is not callable. No constituent of type 'E_TaskState' is callable.
I've done the typechecking and I don't see anything wrong. Do you guys have an explanation ? Here's my code :
C_GenericTask.ts
export default class C_GenericTask {
protected _status: E_TaskState;
constructor(title: string) {
this._status = E_TaskState.TODO;
}
public get status(): E_TaskState {
return this._status;
}
public set setStatus(value: E_TaskState) {
this._status = value;
}
}```
E_TaskState.ts
```enum E_TaskState {
TODO,
DOING,
DONE,
}
export default E_TaskState;```
database.ts
```import C_GenericTask from "./classes/C_GenericTask";
import E_TaskState from "./Enum/E_TaskState";
let C_buildFirst = new C_GenericTask("Build First");
C_buildFirst.setStatus(E_TaskState.DONE);```
You are using a setter here
public set setStatus(value: E_TaskState) {So you have two solutions: