So I'm generating types from a GraphQL schema using graphql-codegen and I get things like:
export type CustomersQuery = (
{ __typename?: 'Query' }
& { customers?: Maybe<(
{ __typename?: 'CustomerPaginator' }
& { data: Array<(
{ __typename?: 'Customer' }
& Pick<Customer, 'id' | 'uuid' | 'name' | 'status' | 'createdAt' | 'accountNumber'>
)> }
)> }
);
I have a React component that gets supplied the contents of one customers.data array element as a prop. I figure I should be specifying that requirement in it's interface right? Currently I have:
interface MyComponentProps {
customer?: Partial<Customer>
}
How can I be more specific and reference that Pick from type CustomersQuery in my interface?
Thanks!
Partial<Omit<NonNullable<CustomersQuery['customers']>['data'][number], '__typename'>>