diff --git a/src/common/channel/request-channel-listener-injection-token.ts b/src/common/channel/request-channel-listener-injection-token.ts index 0455bc2ec2..690b96d9dc 100644 --- a/src/common/channel/request-channel-listener-injection-token.ts +++ b/src/common/channel/request-channel-listener-injection-token.ts @@ -3,11 +3,19 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectionToken } from "@ogre-tools/injectable"; +import type { SetRequired } from "type-fest"; import type { RequestChannel } from "./request-channel-injection-token"; export interface RequestChannelListener> { channel: TChannel; - handler: (request: TChannel["_requestSignature"]) => TChannel["_responseSignature"]; + + handler: ( + request: SetRequired["_requestSignature"] + ) => + | SetRequired["_responseSignature"] + | Promise< + SetRequired["_responseSignature"] + >; } export const requestChannelListenerInjectionToken = getInjectionToken>>( diff --git a/src/main/app-paths/app-paths-request-channel-listener.injectable.ts b/src/main/app-paths/app-paths-request-channel-listener.injectable.ts index 9cf12f5e65..3fd3aec572 100644 --- a/src/main/app-paths/app-paths-request-channel-listener.injectable.ts +++ b/src/main/app-paths/app-paths-request-channel-listener.injectable.ts @@ -3,21 +3,23 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; +import type { RequestChannelListener } from "../../common/channel/request-channel-listener-injection-token"; import { requestChannelListenerInjectionToken } from "../../common/channel/request-channel-listener-injection-token"; +import type { AppPathsChannel } from "../../common/app-paths/app-paths-channel.injectable"; import appPathsChannelInjectable from "../../common/app-paths/app-paths-channel.injectable"; import appPathsInjectable from "../../common/app-paths/app-paths.injectable"; const appPathsRequestChannelListenerInjectable = getInjectable({ id: "app-paths-request-channel-listener", - instantiate: (di) => { + instantiate: (di): RequestChannelListener => { const channel = di.inject(appPathsChannelInjectable); const appPaths = di.inject(appPathsInjectable); - return ({ + return { channel, handler: () => appPaths, - }); + }; }, injectionToken: requestChannelListenerInjectionToken, });