interface Person {
id: string;
age: number;
}
const person: Person = { id: "123", age: 30 };
const picked = pick(person, ["id", "name"] as const);
This generates the error
Type '"name"' is not assignable to type 'keyof Person'.
My understanding is that this should be possible; pick() should simply ignore/exclude keys that don't exist in the object. At least, that's the way I've always used it with vanilla JavaScript.
Consider this example:
This generates the error
My understanding is that this should be possible;
pick()
should simply ignore/exclude keys that don't exist in the object. At least, that's the way I've always used it with vanilla JavaScript.