Skip to content

Commit

Permalink
improve Signal types
Browse files Browse the repository at this point in the history
  • Loading branch information
c12i committed Aug 30, 2024
1 parent 16aa191 commit 89fa9fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
25 changes: 11 additions & 14 deletions src/api/app/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,24 +247,21 @@ export const SignalType = {
/**
* @public
*/
export type RawSignal =
| {
[SignalType.App]: EncodedAppSignal;
}
| {
[SignalType.System]: SystemSignal;
};
export type SignalTypeValues = (typeof SignalType)[keyof typeof SignalType];

/**
* @public
*/
export type Signal =
| {
[SignalType.App]: AppSignal;
}
| {
[SignalType.System]: SystemSignal;
};
export type RawSignal = {
[K in SignalTypeValues]: K extends "App" ? AppSignal : SystemSignal;
};

/**
* @public
*/
export type Signal = {
[K in SignalTypeValues]: K extends "App" ? AppSignal : SystemSignal;
};

/**
* @public
Expand Down
5 changes: 2 additions & 3 deletions test/e2e/app-websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
AppWebsocket,
AppCreateCloneCellRequest,
AppEntryDef,
AppSignal,
CellType,
CloneId,
fakeAgentPubKey,
Expand Down Expand Up @@ -149,7 +148,7 @@ test(
await admin.enableApp({ installed_app_id: app_id1 });

let received1 = false;
const signalCb1: AppSignal = () => {
const signalCb1: SignalCb = () => {
received1 = true;
};

Expand All @@ -164,7 +163,7 @@ test(
await admin.enableApp({ installed_app_id: app_id2 });

let received2 = false;
const signalCb2: AppSignal = () => {
const signalCb2: SignalCb = () => {
received2 = true;
};

Expand Down

0 comments on commit 89fa9fa

Please sign in to comment.