This FEELS like it should be possible but I cannot figure out how to actually achieve it, and I couldn't seem to figure out how to find or ask for it either, so I believe I'm in need of a human being's help...
Essentially, I want to be able to call my function like this: updateObj<myType>("num", 3) where the first argument of the function is a keyof myType, and the second argument is a value in the type of myType["num"].
I thought I would be able to do it like this, but typescript insists that I have to provide both the type AND the key this way. Am I using the syntax wrong / missing a way to actually achieve this?
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.