Say I have the following snippet:
interface State {
alarms: Alarm[];
}
export default class Alarms extends React.Component<{}, State> {
state = {
alarms: []
};
Since I am trying to set alarms: [] Typescript doesn't like it, as [] != Alarm[]. I found that I can use alarms: new Array<Alarm>() which initializes an empty typed array, however I don't really like this syntax - is there an easier/better approach?