Search Terms
pick, nested, deep
Suggestion
Pick can only be used to access properties at the top level of an object, it should support paths to get at more deeply nested values.
Use Cases
Typing form inputs from GraphQL fragments
Examples
type Company = {
id: number;
name: string;
address: {
id: number;
street: string;
city: string;
state: string;
};
}
You could then construct a new type as follows:
type FlatCompany = Pick<Company, "id" | "name" | { "addressId": ["address", "id"] }>
Which would yield:
type FlatCompany = {
id: number;
name: string;
addressId: number;
}
Checklist
My suggestion meets these guidelines:
Search Terms
pick, nested, deep
Suggestion
Pickcan only be used to access properties at the top level of an object, it should support paths to get at more deeply nested values.Use Cases
Typing form inputs from GraphQL fragments
Examples
You could then construct a new type as follows:
type FlatCompany = Pick<Company, "id" | "name" | { "addressId": ["address", "id"] }>Which would yield:
Checklist
My suggestion meets these guidelines: