Hi I have an interface say
export interface employeeRes {
resource? : employeData,
header?: header
}
export interface employeData {
name: string;
lastname: employeeSub;
}
export interface employeeSub {
middlename: string;
lastname: string;
}
I have these three interface(as example) and in my component file i am calling an api and getting response the response I am getting is of type employeeSub interface
so Is it correct to access the employeeSub interface by this way
employeeRes['resource']['lastname']
and my methods looks like this
getUpdateName() {
this.http.get(url).subscribe((res:employeeRes['resource']['lastname'])=>{
console.log(res);
}
}
I just want to access interface and assign it to res to specify the type of the response Don't want to make new file for special interface.
thank's for helping