mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Require requests and responses for RequestChannels be JsonValues for serialization
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
1 parent
8432131b1e
commit
d473551724
5 files changed
+11
-7
No files matched your search
@@ -7,7 +7,7 @@ import type { RequestChannel } from "./request-channel-injection-token";
|
||||
import type { RequestChannelListener } from "./request-channel-listener-injection-token";
|
||||
|
||||
export type EnlistRequestChannelListener = <
|
||||
TChannel extends RequestChannel<unknown, unknown>,
|
||||
TChannel extends RequestChannel<any, any>,
|
||||
>(listener: RequestChannelListener<TChannel>) => () => void;
|
||||
|
||||
export const enlistRequestChannelListenerInjectionToken =
|
||||
|
||||
@@ -4,8 +4,12 @@
|
||||
*/
|
||||
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { JsonValue } from "type-fest";
|
||||
|
||||
export interface RequestChannel<Request = void, Response = void> {
|
||||
export interface RequestChannel<
|
||||
Request extends JsonValue | void = void,
|
||||
Response extends JsonValue | void = void,
|
||||
> {
|
||||
id: string;
|
||||
_requestSignature?: Request;
|
||||
_responseSignature?: Response;
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { SetRequired } from "type-fest";
|
||||
import type { RequestChannel } from "./request-channel-injection-token";
|
||||
|
||||
export type RequestFromChannel = <
|
||||
TChannel extends RequestChannel<unknown, unknown>,
|
||||
TChannel extends RequestChannel<any, any>,
|
||||
>(
|
||||
channel: TChannel,
|
||||
...request: TChannel["_requestSignature"] extends void
|
||||
|
||||
@@ -8,7 +8,7 @@ import { requestChannelInjectionToken } from "../channel/request-channel-injecti
|
||||
|
||||
export type SyncBoxInitialValueChannel = RequestChannel<
|
||||
void,
|
||||
{ id: string; value: unknown }[]
|
||||
{ id: string; value: any }[]
|
||||
>;
|
||||
|
||||
const syncBoxInitialValueChannelInjectable = getInjectable({
|
||||
|
||||
Reference in new issue
Block a user