Skip to content

ToastStreamData

type ToastStreamData<TYield, TReturn> = StreamExternalToast & object;

Defined in: toast-stream.ts:115

Options matching Sonner’s PromiseData pattern

Type Parameter Default type
TYield unknown
TReturn void
Name Type Description Defined in
delay? | number | DelayConfig Artificial delay for visualizing sync streams. - number: applies to all phases (first, items, result) - object: granular control over individual phases Examples // Simple: 500ms for all phases (first, between items, before result) delay: 500 // Granular: different delays for different phases delay: { first: 500, items: 300, result: 200 } toast-stream.ts:146
error? | StreamErrorResultT<TYield> | StreamExtendedErrorResultT<TYield> Message shown on error - callback receives (error, { count, items }) toast-stream.ts:128
finally()? () => void | Promise<void> Called when stream ends (success or error) toast-stream.ts:130
loading? | LoadingResultT | LoadingExtendedResultT Message shown while waiting for first item. Supports string, ReactNode, callback, or extended result with toast options. toast-stream.ts:120
onItem()? (item, count) => void Called for each item received toast-stream.ts:132
streaming? | StreamResultT<StreamingData<TYield>> | StreamExtendedResultT<StreamingData<TYield>> Message shown while streaming - updates on each item toast-stream.ts:122
success? | StreamResultT<SuccessData<TYield, TReturn>> | StreamExtendedResultT<SuccessData<TYield, TReturn>> Message shown on successful completion toast-stream.ts:124