i’ve another stupid question and haven’t found something here.
I have an async store in nodejs, described by a type:
type IAsyncStore {
requestId: string;
startTime: Date;
userId: string;
endTime: Date;
}
and i want to have a function that updates a value:
static updateStore(key: keyof IAsyncStore, value: ???) {
// do some fancy action and update store
this._instance.store.run(this.getStore(), () => this.getStore()[key] = value
}
}
So, my idea was that i have for example key = “endTime”, the value must be of type Date. If i have requestId, the type of value must me string. Is there any way to accomplish this? Or do i have to write an overloaded method for this?
Thanks 🙂