TypeScript: type for an object with only one key (no union type allowed as a key) [duplicate]
If I understand correctly, you want OneKey<“a” | “b”> to be something like {a: any, b?: never} | {a?: never, b: any}. Meaning that it either has an a key or a b key but not both. So you want the type to be some sort of union to represent the either-or part of it. … Read more