Skip to content

Instantly share code, notes, and snippets.

@acao
Created November 8, 2019 04:58
Show Gist options
  • Save acao/f2d1739947436a71bc87911c7b1161ab to your computer and use it in GitHub Desktop.
Save acao/f2d1739947436a71bc87911c7b1161ab to your computer and use it in GitHub Desktop.
import { Component } from 'react';
import { GraphQLSchema } from 'graphql';
export interface GraphiQL extends Component<GraphiQLProps, GraphiQLState> {}
export interface GraphiQLProps {
fetcher?: (props: { query: string; operationName: string }) => Promise<any>;
schema?: GraphQLSchema;
query?: string;
variables?: string;
operationName?: string;
response?: string;
storage: {
getItem: (name: string) => any;
setItem: (name: string, item: any) => void;
removeItem: (name: string) => void;
};
defaultQuery?: string;
defaultVariableEditorOpen?: boolean;
onCopyQuery?: Function;
onEditQuery?: Function;
onEditVariables?: Function;
onEditOperationName?: Function;
onToggleDocs?: Function;
getDefaultFieldNames?: Function;
editorTheme?: string;
onToggleHistory?: Function;
ResultsTooltip?: any;
readOnly?: boolean;
docExplorerOpen?: boolean;
}
export interface GraphiQLState {
schema?: GraphQLSchema;
response?: string;
query?: string;
}
export type RenderConfig = {
/**
* the url if no fetcher is provided
*/
url: string;
/**
* the headers if no fetcher is provided
*/
headers: Headers;
containerId?: string;
containerEl?: HTMLElement;
} & GraphiQLProps;
declare function renderGraphiQL(config?: RenderConfig): Promise<void>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment