UNPKG

1.41 kBTypeScriptView Raw
1type Maybe<T> = T | null;
2/** All built-in and custom scalars, mapped to their actual values */
3export type Scalars = {
4 ID: string;
5 String: string;
6 Boolean: boolean;
7 Int: number;
8 Float: number;
9};
10
11export type MyType = {
12 f?: Maybe<Scalars['String']>;
13};
14
15export type Query = {
16 f?: Maybe<Scalars['String']>;
17};
18export type MyQueryQueryVariables = {};
19
20export type MyQueryQuery = { __typename?: 'Query' } & Pick<Query, 'f'>;
21
22import gql from 'graphql-tag';
23import * as React from 'react';
24import * as ReactApollo from 'react-apollo';
25export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
26
27export const MyQueryDocument = gql`
28 query MyQuery {
29 f
30 }
31`;
32
33export const MyQueryComponent = (props: Omit<Omit<ReactApollo.QueryProps<MyQueryQuery, MyQueryQueryVariables>, 'query'>, 'variables'> & { variables?: MyQueryQueryVariables }) => (
34 <ReactApollo.Query<MyQueryQuery, MyQueryQueryVariables> query={MyQueryDocument} {...props} />
35);
36
37export type MyQueryProps<TChildProps = {}> = Partial<ReactApollo.DataProps<MyQueryQuery, MyQueryQueryVariables>> & TChildProps;
38export function withMyQuery<TProps, TChildProps = {}>(operationOptions?: ReactApollo.OperationOption<TProps, MyQueryQuery, MyQueryQueryVariables, MyQueryProps<TChildProps>>) {
39 return ReactApollo.withQuery<TProps, MyQueryQuery, MyQueryQueryVariables, MyQueryProps<TChildProps>>(MyQueryDocument, operationOptions);
40}