nested objects typescript code example
Example 1: creating object of type nested
interface EndpointAuth {
login: string;
}
interface Endpoint {
auth: EndpointAuth;
}
const endpoints: Endpoint = {
auth: {
login: "http://localhost:8079/auth/login"
}
};
Example 2: nested array typescript
interface IThing {
active: boolean
}
interface IStuff {
name: string;
things: IThing[]
}
var blopp: IStuff[] = [
{ name: "aa", things: [{ active: true }, { active: false }] },
{ name: "bb", things: null }];