I have a tasks that have a common interface and some extensions:
export interface Task {
name: string;
id: number;
type: taskType
}
export enum taskType {
EVENT = 'EVENT',
NOTES = 'NOTES',
}
These are the extensions of Task:
export interface EventTask extends Task {
startDate: Date,
endDate: Date
}
export interface NotesTask extends Task {
description: string,
}
When I get the backend result I can get these array, data properties change based on type:
[{id: 1, name: 'TaskNote1', type: 'NOTES', description: 'Hello world'}, {id: 2, name:
'TaskEvent1', type: 'EVENT', startDate: '2021-04-04', endDate: '2021-04-19'}];
How can Obtain these variable model into the Task interface? I can't find a solution