···11import type { Refs, Symbol } from '@hey-api/codegen-core';
22-import type ts from 'typescript';
3243import type { IR } from '~/ir/types';
54import type { DefinePlugin, Plugin, SchemaWithType } from '~/plugins';
···87 ShouldCoerceToBigInt,
98} from '~/plugins/shared/utils/coerce';
109import type { GetIntegerLimit } from '~/plugins/shared/utils/formats';
1111-import type { $, DollarTsDsl, TsDsl } from '~/ts-dsl';
1010+import type { $, DollarTsDsl } from '~/ts-dsl';
1211import type { StringCase, StringName } from '~/types/case';
1313-import type { MaybeArray } from '~/types/utils';
14121513import type { IApi } from './api';
1614import type { Pipe, PipeResult, PipesUtils } from './shared/pipes';
···328326 };
329327 };
330328331331-type SharedResolverArgs = DollarTsDsl & {
329329+interface BaseResolverContext extends DollarTsDsl {
332330 /**
333331 * Functions for working with pipes.
334332 */
335335- pipes: PipesUtils;
333333+ pipes: PipesUtils & {
334334+ /**
335335+ * The current builder state being processed by this resolver.
336336+ *
337337+ * In Valibot, this represents the current list of call expressions ("pipes")
338338+ * being assembled to form a schema definition.
339339+ *
340340+ * Each pipe can be extended, modified, or replaced to customize how the
341341+ * resulting schema is constructed.
342342+ */
343343+ current: Pipes;
344344+ };
336345 plugin: ValibotPlugin['Instance'];
337346 /**
338338- * The current builder state being processed by this resolver.
339339- *
340340- * In Valibot, this represents the current list of call expressions ("pipes")
341341- * being assembled to form a schema definition.
342342- *
343343- * Each pipe can be extended, modified, or replaced to customize how the
344344- * resulting schema is constructed.
345345- */
346346- result: Pipes;
347347- /**
348347 * Provides access to commonly used symbols within the Valibot plugin.
349348 */
350349 symbols: {
351350 v: Symbol;
352351 };
353353-};
352352+}
354353355355-export type NumberResolverContext = SharedResolverArgs & {
354354+export interface NumberResolverContext extends BaseResolverContext {
356355 /**
357356 * Nodes used to build different parts of the number schema.
358357 */
···371370 maybeBigInt: MaybeBigInt;
372371 shouldCoerceToBigInt: ShouldCoerceToBigInt;
373372 };
374374-};
373373+}
375374376376-export type ObjectResolverContext = SharedResolverArgs & {
375375+export interface ObjectResolverContext extends BaseResolverContext {
377376 /**
378377 * Nodes used to build different parts of the object schema.
379378 */
···396395 ast: Partial<Omit<Ast, 'typeName'>>;
397396 state: Refs<PluginState>;
398397 };
399399-};
398398+}
400399401401-export type StringResolverContext = SharedResolverArgs & {
400400+export interface StringResolverContext extends BaseResolverContext {
402401 /**
403402 * Nodes used to build different parts of the string schema.
404403 */
···412411 pattern: (ctx: StringResolverContext) => PipeResult | undefined;
413412 };
414413 schema: SchemaWithType<'string'>;
415415-};
414414+}
416415417417-export type ValidatorResolverArgs = SharedResolverArgs & {
416416+export interface ValidatorResolverContext extends BaseResolverContext {
418417 operation: IR.Operation;
419419- schema: Symbol;
420420-};
418418+ /**
419419+ * Provides access to commonly used symbols within the Valibot plugin.
420420+ */
421421+ symbols: BaseResolverContext['symbols'] & {
422422+ schema: Symbol;
423423+ };
424424+}
421425422426type ValidatorResolver = (
423423- args: ValidatorResolverArgs,
424424-) => MaybeArray<TsDsl<ts.Statement>> | null | undefined;
427427+ args: ValidatorResolverContext,
428428+) => PipeResult | null | undefined;
425429426430type Resolvers = Plugin.Resolvers<{
427431 /**
···455459 *
456460 * Example path: `~resolvers.validator.request` or `~resolvers.validator.response`
457461 *
458458- * Returning `undefined` from a resolver will apply the default generation logic.
462462+ * Returning `undefined` will execute the default resolver logic.
459463 */
460464 validator?:
461465 | ValidatorResolver
···463467 /**
464468 * Controls how the request validator function body is generated.
465469 *
466466- * Returning `undefined` will fall back to the default `.await().return()` logic.
470470+ * Returning `undefined` will execute the default resolver logic.
467471 */
468472 request?: ValidatorResolver;
469473 /**
470474 * Controls how the response validator function body is generated.
471475 *
472472- * Returning `undefined` will fall back to the default `.await().return()` logic.
476476+ * Returning `undefined` will execute the default resolver logic.
473477 */
474478 response?: ValidatorResolver;
475479 };