I'm looking for the most appropriate way to declare an array of objects as a property when declaring a class using TypeScript. This is for use with a form that will have an unknown number of checkboxes for an Angular Template-Driven form.
Is it advisable to have a separate class for the objects, as I have below, or is there a better way? Tried searching for advice on this in many ways and can't find much. Am I way off the mark here?
export class Companion {
id: string;
name: string;
chosen: boolean;
}
export class ExampleForm {
name: string;
email: string;
companions: Companion[];
}
classand not justinterface?