Rxova
Skip to content

ReplyMap

type ReplyMap<M> = Partial<Record<keyof M, unknown>>;

What each message type answers with, for ask/answer.

A separate map from the request types, and empty by default, so request/response is opt-in and typed rather than unknown everywhere.

type Requests = { 'config:get': void };
type Replies = { 'config:get': { theme: string } };
const channel = createChannel<Requests, Replies>('app');
Type Parameter
M extends MessageMap