@pothos/plugin-errors
Version:
A Pothos plugin for adding typed errors into your schema
22 lines • 1.33 kB
TypeScript
import type { FieldNullability, InputFieldMap, SchemaTypes, ShapeFromTypeParam, TypeParam } from '@pothos/core';
import type { PothosErrorsPlugin } from '.';
import type { ErrorFieldOptions, ErrorsPluginOptions } from './types';
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