Skip to content

Interface: SignalPayloadBuilder<TPayload> ​

Defined in: builders/signal-payload-builder.ts:12

Fluent builder returned by P.signal(id) with .payload(schema) configuration and direct AST property access.

Extends SignalBuilder<TPayload> so the builder can be passed directly wherever a SignalNode<TPayload> or AstBuilder<SignalNode<TPayload>> is expected.

Extends ​

Type Parameters ​

Type ParameterDefault typeDescription
TPayloadunknownSignal payload type validated by schema.

Methods ​

payload() ​

ts
payload<TNext>(schema): SignalPayloadBuilder<TNext>;

Defined in: builders/signal-payload-builder.ts:27

Binds a Zod payload schema to the signal and returns a new immutable SignalPayloadBuilder<TNext>.

Replaces the default z.unknown() payload schema while preserving the signal's id.

Type Parameters ​

Type ParameterDescription
TNextNew signal payload output type inferred from schema.

Parameters ​

ParameterTypeDescription
schemaZodType<TNext>Zod schema validating signal payloads.

Returns ​

SignalPayloadBuilder<TNext>

New immutable signal builder instance.

Overrides ​

SignalBuilder.payload


toAST() ​

ts
toAST(): SignalNode;

Defined in: ast/ast-builder.ts:20

Compiles the current builder configuration into a deeply frozen passive AST node.

Validates required builder invariants at compilation time and returns an immutable plain-object AST representation containing zero execution methods.

Returns ​

SignalNode

Deeply frozen passive AST node.

Inherited from ​

SignalBuilder.toAST

Properties ​

PropertyModifierTypeDescriptionOverridesInherited fromDefined in
idreadonlystringUnique logical identifier of the signal.-SignalBuilder.idast/signal-builder.ts:17
schemareadonlyZodType<TPayload>Zod schema used to validate payloads emitted for this signal.-SignalBuilder.schemaast/signal-builder.ts:19
typereadonly"harness:signal"Discriminant identifying a signal AST node.SignalBuilder.type-builders/signal-payload-builder.ts:14

Released under the MIT License.