Type Alias: OptionalResult<T>
Makaio Framework / bus-core / OptionalResult
Type Alias: OptionalResult<T>
Section titled “Type Alias: OptionalResult<T>”OptionalResult<
T> = {data:T;handled:true; } | {handled:false; }
Defined in: ../../../packages/makaio-core/src/types/result.ts:23
Discriminated union for optional request results.
handled: true- A handler was found and returned datahandled: false- No handler was registered for the subject
Type Parameters
Section titled “Type Parameters”T
Example
Section titled “Example”const result = await bus.requestOptional(Subjects.getData, { id: '123' });if (result.handled) { console.debug('Got data:', result.data);} else { console.debug('No handler registered for getData');}Type Composition
Section titled “Type Composition”OptionalResult{ handled: true; data: T } | { handled: false }{ handled: true; data: T }{ handled: false }
Resolved Shape
Section titled “Resolved Shape”type OptionalResult = { handled: boolean;};