| "b";
type UnionKeyObj = {
[key in UnionKey]: string;
}
const myObj: UnionKeyObj = { a: "hi" } // err, prop "b" missing
I can do this to type the keys of the obj as every value of the union, but what if I don't necessarily want every value, and just want to restrict keys to the possibilities in the union?
[]?:
Обсуждают сегодня