Skip to main content

InferEvents

@rotorsoft/act-root


@rotorsoft/act-root / act/src / InferEvents

Type Alias: InferEvents<T>

InferEvents<T> = { [K in keyof T["events"]]: T["events"][K] extends ZodType<infer V> ? V : never }

Defined in: libs/act/src/types/action.ts:390

Extracts the raw event schemas from a State definition.

Use this to recover the TEvents type parameter from a built State object, enabling typed event handling without repeating the mapped type boilerplate.

Type Parameters

T

T extends object

A State object (or any object with readonly events: ZodTypes<TEvents>)

Example

type Events = InferEvents<typeof Counter>;
// => { Incremented: { amount: number } }