If I have an interface:
export interface Person {
[key: string]: {
name: string;
alias: string;
active: string[];
values: string[];
};
}
If I want to access:
{
name: string;
alias: string;
active: string[];
values: string[];
};
How can I do this? I tried Person[keyof typeof Person]
but this does not work.
CodePudding user response:
type X = Person[keyof Person];
Will return type:
type X = {
name: string;
alias: string;
active: string[];
values: string[];
}