UNPKG

@pothos/plugin-simple-objects

Version:

A Pothos plugin for defining objects and interfaces without ts definitions for those types

31 lines 2.74 kB
import type { FieldMap, FieldNullability, InputFieldMap, InterfaceFieldsShape, InterfaceParam, Normalize, ObjectFieldsShape, ParentShape, SchemaTypes, TypeParam, UnionToIntersection } from '@pothos/core'; import type { PothosSimpleObjectsPlugin } from '.'; import type { OutputShapeFromFields, SimpleObjectFieldsShape } from './types'; declare global { export namespace PothosSchemaTypes { interface Plugins<Types extends SchemaTypes> { simpleObjects: PothosSimpleObjectsPlugin<Types>; } interface SchemaBuilder<Types extends SchemaTypes> { simpleObject: <const Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape extends Normalize<OutputShapeFromFields<Fields> & UnionToIntersection<ParentShape<Types, Interfaces[number]>>>>(name: string, options: SimpleObjectTypeOptions<Types, Interfaces, Fields, Shape>, fields?: ObjectFieldsShape<Types, Shape>) => ObjectRef<Types, Shape>; simpleInterface: <const Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape extends Normalize<OutputShapeFromFields<Fields> & UnionToIntersection<ParentShape<Types, Interfaces[number]>>>>(name: string, options: SimpleInterfaceTypeOptions<Types, Interfaces, Fields, Shape>, fields?: InterfaceFieldsShape<Types, Shape>) => InterfaceRef<Types, Shape>; } interface PothosKindToGraphQLType { SimpleObject: 'Object'; SimpleInterface: 'Interface'; } interface FieldOptionsByKind<Types extends SchemaTypes, ParentShape, Type extends TypeParam<Types>, Nullable extends FieldNullability<Type>, Args extends InputFieldMap, ResolveShape, ResolveReturnShape> { SimpleObject: ObjectFieldOptions<Types, ParentShape, Type, Nullable, Args, ResolveReturnShape>; SimpleInterface: InterfaceFieldOptions<Types, ParentShape, Type, Nullable, Args, ResolveReturnShape>; } type SimpleObjectTypeOptions<Types extends SchemaTypes, Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape> = Omit<ObjectTypeOptions<Types, Shape> | ObjectTypeWithInterfaceOptions<Types, Shape, Interfaces>, 'fields' | 'interfaces'> & { interfaces?: (() => Interfaces) | Interfaces; fields?: SimpleObjectFieldsShape<Types, Fields>; }; interface SimpleInterfaceTypeOptions<Types extends SchemaTypes, Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape> extends Omit<InterfaceTypeOptions<Types, Shape, Interfaces>, 'fields' | 'interfaces'> { interfaces?: (() => Interfaces) | Interfaces; fields?: SimpleObjectFieldsShape<Types, Fields>; } } } //# sourceMappingURL=global-types.d.ts.map