Function: field()

field<TParent, TOutput, TInput>(output, resolveOrOptions): FieldOrOperation<SchemaToSilk<GraphQLSilkIO | ZodSchemaIO, TParent>, SchemaToSilk<GraphQLSilkIO | ZodSchemaIO, TOutput>, InputSchemaToSilk<GraphQLSilkIO | ZodSchemaIO, TInput>, "field">

Type Parameters

TParent extends GraphQLSilk<any, any> | ZodType<any, ZodTypeDef, any>

TOutput extends GraphQLSilk<any, any> | ZodType<any, ZodTypeDef, any>

TInput extends InputSchema<GraphQLSilk<any, any> | ZodType<any, ZodTypeDef, any>> = undefined

Parameters

output: TOutput

resolveOrOptions: FieldOptions<GraphQLSilkIO | ZodSchemaIO, TParent, TOutput, TInput> | (parent) => MayPromise<"~standard" extends keyof TOutput ? "types" extends keyof NonNullable<TOutput[keyof ... & "~standard"]> ? "output" extends keyof NonNullable<NonNullable<...>[... & ...]> ? NonNullable<NonNullable<...>[... & ...]>[keyof NonNullable<...> & "output"] : never : never : never | "_output" extends keyof TOutput ? TOutput[keyof TOutput & "_output"] : never>

Returns

FieldOrOperation<SchemaToSilk<GraphQLSilkIO | ZodSchemaIO, TParent>, SchemaToSilk<GraphQLSilkIO | ZodSchemaIO, TOutput>, InputSchemaToSilk<GraphQLSilkIO | ZodSchemaIO, TInput>, "field">

Defined in

packages/zod/src/index.ts:465