There is an implementation for the:
let employee = {
name:'John Smith',
salary:50_000,
address:{
street:'Flinders st',
city:'Melbourne',
zipCode:3144,
},
}
That looks like this:
interface Address {
street:string;
city:string;
zipCode:number;
}
interfaceEmployee {
name:string;
salary:number;
address:Address;
}
Is this also valid?
interface Address
{
street: string;
city: string;
zipCode: number;
}
interface Employee extends Address
{
name: string;
salary: number;
}
In this case you’ll have access to members without going through [address.] to reference sub-members.
Is one form more desirable than the other?
Thank you.