Hi angular community,
Is it possible to include three interfaces nested inside another, think my code will explain it more than my sentence: I am trying to implement the interface IProject1 & IProject2 & IProject3 to be part of the IAdmin2 interface:
Thanks in advance
import {IBusiness} from "./business";
import {ITechnology} from "./technology";
export interface IAdmin2 {
id: number;
business_id: number;
technology_ids: number[];
trigram: string;
position: string;
years_experience: number;
notification: boolean;
availability: any;
form_admin2_file: File;
business: IBusiness;
technologies: ITechnology[];
admin2Translations: any;
translations: any;
delete: any;
data: any;
** Include interface Iproject1**
** Include interface Iproject2**
** Include interface Iproject3**
}
import {ITechnology} from "./technology";
import {IProjectFile} from "./project-file";
export interface IProject1 {
id: number;
name: string;
start_date: any;
technologies: ITechnology[];
description: string;
sector_id: number;
end_date: any;
team_size: number;
}
import {ITechnology} from "./technology";
import {IProjectFile} from "./project-file";
export interface IProject2 {
id: number;
name: string;
start_date: any;
technologies: ITechnology[];
description: string;
sector_id: number;
end_date: any;
team_size: number;
}
import {ITechnology} from "./technology";
import {IProjectFile} from "./project-file";
export interface IProject3 {
id: number;
name: string;
start_date: any;
technologies: ITechnology[];
description: string;
sector_id: number;
end_date: any;
team_size: number;
}
In TypeScript you can inherit an interface from one or more base interfaces:
interface IProject1 {
}
interface IProject2 {
}
interface IProject3 {
}
interface IAdmin2 extends IProject1, IProject2, IProject3 {
}
As a result, implementations of IAdmin2 will also have to implement IProject1, IProject2 and IProject3. You can also check the official documentation of interfaces.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With