Skip to content

electron-reactive-event / API / Main / Response

Response Type

ts
type Response<ChannelType, Registrar> =
	ResponseDeclKey extends keyof Registrar[ChannelType]
		? Registrar[ChannelType][ResponseDeclKey] extends EmptyEventParameter
			?
					| {
							Error: Error<ChannelType, Registrar>;
					  }
					| {
							Error: undefined;
					  }
			:
					| {
							Data: Success<ChannelType, Registrar>;
							Error: undefined;
					  }
					| {
							Data: undefined;
							Error: Error<ChannelType, Registrar>;
					  }
		: never;

The type received by main callbacks.

This corresponds—but is not identical to—the request types of events sent by the renderer.

Type Parameters

ChannelType

ChannelType extends Channel<Registrar>

The desired channel of the given Registrar.

Registrar

Registrar extends IRendererRegistrarBase

The registrar interface that holds the desired event declaration.