graphql-modules
Version:
Create reusable, maintainable, testable and extendable GraphQL modules
23 lines (22 loc) • 864 B
TypeScript
import { GraphQLFieldResolver, GraphQLTypeResolver } from 'graphql';
import { Injector } from '../di';
export type ID = string;
export type Nil = undefined | null;
export type Maybe<T> = T | Nil;
export type Plural<T> = T | T[];
export type Single<T> = T extends Array<infer R> ? R : T;
export type ValueOrPromise<T> = T | Promise<T>;
export type ResolveFn<TContext = GraphQLModules.Context> = GraphQLFieldResolver<any, TContext, Record<string, any>>;
export type ResolveTypeFn<TContext = GraphQLModules.Context> = GraphQLTypeResolver<any, TContext>;
declare global {
namespace GraphQLModules {
type ModuleContext = {
injector: Injector;
moduleId: ID;
} & GlobalContext;
type AppContext = Omit<ModuleContext, 'moduleId'>;
type Context = ModuleContext;
interface GlobalContext {
}
}
}