UNPKG

@pothos/plugin-errors

Version:

A Pothos plugin for adding typed errors into your schema

25 lines (24 loc) 1.37 kB
import type { FieldNullability, InputFieldMap, SchemaTypes, ShapeFromTypeParam, TypeParam } from '@pothos/core'; import type { PothosErrorsPlugin } from './index.js'; import type { ErrorFieldOptions, ErrorsPluginOptions } from './types.js'; declare global { export namespace PothosSchemaTypes { interface Plugins<Types extends SchemaTypes> { errors: PothosErrorsPlugin<Types>; } interface SchemaBuilderOptions<Types extends SchemaTypes> { errors?: ErrorsPluginOptions<Types>; } interface V3SchemaBuilderOptions<Types extends SchemaTypes> { errors: never; errorOptions?: ErrorsPluginOptions<Types>; } interface FieldOptions<Types extends SchemaTypes = SchemaTypes, ParentShape = unknown, Type extends TypeParam<Types> = TypeParam<Types>, Nullable extends FieldNullability<Type> = FieldNullability<Type>, Args extends InputFieldMap = InputFieldMap, ResolveShape = unknown, ResolveReturnShape = unknown> { errors?: ErrorFieldOptions<Types, Type, ShapeFromTypeParam<Types, Type, false>, Nullable>; itemErrors?: Type extends [ infer Item extends TypeParam<Types> ] ? ErrorFieldOptions<Types, Item, ShapeFromTypeParam<Types, Item, false>, false> : never; } } } //# sourceMappingURL=global-types.d.ts.map