Skip to content

defineAction

function defineAction<TInput, TOutput>(definition): Action<TInput, TOutput>;

Defined in: core/src/action/action.types.ts:46

Define an action, wrapping its execute so input is validated against the input schema before running and the return value against the output schema after. Throws ActionInputValidationError or ActionOutputValidationError respectively on a schema mismatch.

Type Parameter
TInput extends ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>
TOutput extends ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>
Parameter Type
definition Action<TInput, TOutput>

Action<TInput, TOutput>