From 74c36c1ebf7d3d7e5b254e300c41c61706c1333b Mon Sep 17 00:00:00 2001 From: Marcus Pousette Date: Sat, 28 Dec 2024 12:37:06 +0100 Subject: [PATCH] chore: fix types --- .../window/e2e/browser/child/src/App.tsx | 27 ++++++++++--------- .../window/e2e/browser/child/src/db.ts | 2 +- .../peerbit-server/node/test/api.spec.ts | 3 ++- .../programs/data/string/src/string-store.ts | 4 +-- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/packages/clients/peerbit-proxy/window/e2e/browser/child/src/App.tsx b/packages/clients/peerbit-proxy/window/e2e/browser/child/src/App.tsx index 6f6ee5c33..054a91fdf 100644 --- a/packages/clients/peerbit-proxy/window/e2e/browser/child/src/App.tsx +++ b/packages/clients/peerbit-proxy/window/e2e/browser/child/src/App.tsx @@ -8,7 +8,7 @@ const client = await createClient("*"); export const App = () => { const mounted = useRef(false); - const dbRef = useRef(); + const dbRef = useRef>(); const [_, forceUpdate] = useReducer((x) => x + 1, 0); useEffect(() => { const queryParameters = new URLSearchParams(window.location.search); @@ -18,19 +18,22 @@ export const App = () => { } mounted.current = true; client - .open>(new SharedLog({ id: new Uint8Array(32) }), { - args: { - onChange: (change: Change) => { - forceUpdate(); - setTimeout(() => { - dbRef.current?.log.load().then(() => { - forceUpdate(); - console.log(client.messages.id, dbRef.current?.log.length); - }); - }, 1000); + .open>( + new SharedLog({ id: new Uint8Array(32) }), + { + args: { + onChange: (change: Change) => { + forceUpdate(); + setTimeout(() => { + dbRef.current?.log.load().then(() => { + forceUpdate(); + console.log(client.messages.id, dbRef.current?.log.length); + }); + }, 1000); + }, }, }, - }) + ) .then((x: any) => { dbRef.current = x; if (queryParameters.get("read") !== "true") { diff --git a/packages/clients/peerbit-proxy/window/e2e/browser/child/src/db.ts b/packages/clients/peerbit-proxy/window/e2e/browser/child/src/db.ts index 6f87ac0c6..a648b01d4 100644 --- a/packages/clients/peerbit-proxy/window/e2e/browser/child/src/db.ts +++ b/packages/clients/peerbit-proxy/window/e2e/browser/child/src/db.ts @@ -5,7 +5,7 @@ import { SharedLog } from "@peerbit/shared-log"; @variant("test-log") export class TestLog extends Program { @field({ type: SharedLog }) - log: SharedLog; + log: SharedLog; constructor() { super(); diff --git a/packages/clients/peerbit-server/node/test/api.spec.ts b/packages/clients/peerbit-server/node/test/api.spec.ts index 2c4f83a24..074e0b9b2 100644 --- a/packages/clients/peerbit-server/node/test/api.spec.ts +++ b/packages/clients/peerbit-server/node/test/api.spec.ts @@ -75,7 +75,9 @@ describe("server", () => { let node: Peerbit; afterEach(async () => { + // @ts-ignore await node?.stop(); + // @ts-ignore server?.close(); }); it("bootstrap on start", async () => { @@ -92,7 +94,6 @@ describe("server", () => { describe("api", () => { let session: TestSession, peer: ProgramClient, server: http.Server; let db: PermissionedString; - before(async () => {}); beforeEach(async () => { diff --git a/packages/programs/data/string/src/string-store.ts b/packages/programs/data/string/src/string-store.ts index 293a036a9..2f51fa4c6 100644 --- a/packages/programs/data/string/src/string-store.ts +++ b/packages/programs/data/string/src/string-store.ts @@ -53,7 +53,7 @@ export type CanPerform = ( export type Args = { canRead?: CanRead; canPerform?: CanPerform; - log?: SharedLogOptions; + log?: SharedLogOptions>; }; export type TransactionContext = { @@ -62,7 +62,7 @@ export type TransactionContext = { @variant("dstring") export class DString extends Program { @field({ type: SharedLog }) - _log: SharedLog; + _log: SharedLog; @field({ type: RPC }) query: RPC;