Suppose I have a type definition like this:
Person which must have either name or fullname property defined
type Person = {
[k in "name" | "fullname"]: string;
};
Suppose I want to add one more required property age, intuitively I'd write something like this:
type Person = {
[k in "name" | "fullname"]: string;
age: number; // This errors
};
However this syntax will not work, the only way is to use intersection operator & like this:
type Person = {
[k in "name" | "fullname"]: string;
} & { age: number };