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
Did you mean:
type RefetchObj = {
refetch: void => void,
}
type Identity<T: {}> = {
data: T & RefetchObj
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.