UNPKG

783 BTypeScriptView Raw
1import { BuildSchemaOptions, DocumentNode, GraphQLSchema } from 'graphql';
2import { GraphQLParseOptions } from './Interfaces.js';
3export interface Source {
4 document?: DocumentNode;
5 schema?: GraphQLSchema;
6 rawSDL?: string;
7 location?: string;
8}
9export type BaseLoaderOptions = GraphQLParseOptions & BuildSchemaOptions & {
10 cwd?: string;
11 ignore?: string | string[];
12 includeSources?: boolean;
13};
14export type WithList<T> = T | T[];
15export type ElementOf<TList> = TList extends Array<infer TElement> ? TElement : never;
16export interface Loader<TOptions extends BaseLoaderOptions = BaseLoaderOptions> {
17 load(pointer: string, options?: TOptions): Promise<Source[] | null | never>;
18 loadSync?(pointer: string, options?: TOptions): Source[] | null | never;
19}