Reputation: 3518
I am trying to make a configurable type as follows:
import * as React from 'react';
type Identity<T: {}> = {
data: {
refetch: void => void,
T: {}
}
};
({ data }: Identity<{foo: string }>) => <div>{data.foo}</div>;
But I am getting:
Cannot get data.foo because property foo is missing in object type [1].
Am I missing something obvious? This is the shape of graphql hoc return data.
Thank you
Upvotes: 1
Views: 80
Reputation: 99816
Did you mean:
type RefetchObj = {
refetch: void => void,
}
type Identity<T: {}> = {
data: T & RefetchObj
};
Upvotes: 2