I'm using javascript to create an object and want to add in an interface for the data:
Javascript:
const childGroups: Children = {};
childGroups.children = [];
// Pushing some data
childGroups.children.push(children);
Interface:
export interface Child {
ClusterPoint
}
export interface Children {
children: {
[key: number]: Child
}
}
I'm getting the below errors:
Property 'children' is missing in type '{}' but required in type 'Children'. Property 'push' does not exist on type {[key: number]: Child}
The data looks this:
Any help would be appreciated.
Update
Thanks to Nikita Madeev, I managed to get it to work with this:
export interface Child {
children: {
ClusterPoint
};
}
export interface Children {
children: Child[];
}
