So I am Having this small little function for pinia. Where I do throw in an ID of my Object to filter it (result is of type Task | undefined
)
I am giving in a Key which should of course be a keyof Task
and now I kind of struggle with the value
part. I've tried to find out what serves my usecase best, it must be something like a value Of or so but I do currently not find the correct Utility Type (if it even should be one).
changeValue(id: number, key: keyof Task , value: Partial<Task>) {
const task = this.one(id);
if (task) {
task[key] = value;
}
}
Also I have a Second Problem here that task[key]
says its of type never
can anyone explain why this is of type never?