I want to write an interface or type with typescript to enforce the type of known fields, and also some dynamic ones.
Example:
const person = {
children: [person1, person2],
name: "X",
dynamicField1: person3,
dynamicField2: person4,
dynamicField3: person5
}
// Something that would look like this
interface Person {
name: string;
children: Person[];
...rest: Person;
}
Is it possible to to that in typescript ?