Issue
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.
Solution
type X = Person[keyof Person];
Will return type:
type X = {
name: string;
alias: string;
active: string[];
values: string[];
}
Answered By - Art Bauer
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.