From f3e74aed34ba031d42c052c12dea4f7498db2b9c Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Mon, 6 Apr 2026 15:05:57 +0200 Subject: [PATCH] fix: resolve all TypeScript type errors - Install missing comlink (was in lockfile but not node_modules) - Add @ts-rest/core and @ts-rest/vue-query (imported but not declared as deps) - Add declare module '*.vue' shim to shims-vue.d.ts - Replace arktype validators in ts-rest contract with contract.type() since @ts-rest expects Zod schemas --- package.json | 2 ++ pnpm-lock.yaml | 39 +++++++++++++++++++++++++++++++++ src/modules/post/data/client.ts | 22 +++++-------------- src/shims-vue.d.ts | 6 +++++ 4 files changed, 52 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index f74cb15..0d39c67 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,8 @@ "@tailwindcss/postcss": "^4.1.16", "@tanstack/vue-query": "^5.92.9", "@toycode/markdown-it-class": "^1.2.4", + "@ts-rest/core": "^3.52.1", + "@ts-rest/vue-query": "^3.52.1", "@vscode/markdown-it-katex": "^1.1.2", "@vueuse/components": "^14.2.1", "@vueuse/core": "^13.6.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f0777e7..b5a60dc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -38,6 +38,12 @@ importers: '@toycode/markdown-it-class': specifier: ^1.2.4 version: 1.2.4 + '@ts-rest/core': + specifier: ^3.52.1 + version: 3.52.1(@types/node@22.15.24)(zod@3.25.76) + '@ts-rest/vue-query': + specifier: ^3.52.1 + version: 3.52.1(@tanstack/vue-query@5.92.9(vue@3.5.18(typescript@5.9.3)))(@ts-rest/core@3.52.1(@types/node@22.15.24)(zod@3.25.76))(zod@3.25.76) '@vscode/markdown-it-katex': specifier: ^1.1.2 version: 1.1.2 @@ -2112,6 +2118,27 @@ packages: '@toycode/markdown-it-class@1.2.4': resolution: {integrity: sha512-hA4gHBK8moObkOYdWTjhy1wYcYy0MJeM3JjSKbsXHRpRMvIKhk6Jm+t3bXsSScTdz/byWqQbs8YIwVYjHp+SlQ==} + '@ts-rest/core@3.52.1': + resolution: {integrity: sha512-tAjz7Kxq/grJodcTA1Anop4AVRDlD40fkksEV5Mmal88VoZeRKAG8oMHsDwdwPZz+B/zgnz0q2sF+cm5M7Bc7g==} + peerDependencies: + '@types/node': ^18.18.7 || >=20.8.4 + zod: ^3.22.3 + peerDependenciesMeta: + '@types/node': + optional: true + zod: + optional: true + + '@ts-rest/vue-query@3.52.1': + resolution: {integrity: sha512-89u7aS9LGDC7uNUC5CagWX1EB7vTwyXohYcizLi1D9v7MD/Cnu5OTQNf8SY3PuAK62RcFJXB2XZGsMAPC0svNw==} + peerDependencies: + '@tanstack/vue-query': ^4.0.0 + '@ts-rest/core': ~3.52.0 + zod: ^3.22.3 + peerDependenciesMeta: + zod: + optional: true + '@tybys/wasm-util@0.10.1': resolution: {integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==} @@ -8400,6 +8427,18 @@ snapshots: '@toycode/markdown-it-class@1.2.4': {} + '@ts-rest/core@3.52.1(@types/node@22.15.24)(zod@3.25.76)': + optionalDependencies: + '@types/node': 22.15.24 + zod: 3.25.76 + + '@ts-rest/vue-query@3.52.1(@tanstack/vue-query@5.92.9(vue@3.5.18(typescript@5.9.3)))(@ts-rest/core@3.52.1(@types/node@22.15.24)(zod@3.25.76))(zod@3.25.76)': + dependencies: + '@tanstack/vue-query': 5.92.9(vue@3.5.18(typescript@5.9.3)) + '@ts-rest/core': 3.52.1(@types/node@22.15.24)(zod@3.25.76) + optionalDependencies: + zod: 3.25.76 + '@tybys/wasm-util@0.10.1': dependencies: tslib: 2.8.1 diff --git a/src/modules/post/data/client.ts b/src/modules/post/data/client.ts index b32bfca..a765e17 100644 --- a/src/modules/post/data/client.ts +++ b/src/modules/post/data/client.ts @@ -29,31 +29,19 @@ export const noteRouter = contract.router({ noteLists: { method: "GET", path: "/notes", - query: type({ - cursor: "string | undefined", - limit: "number | undefined" - }), + query: contract.type<{ cursor?: string; limit?: number }>(), responses: { - 200: type({ - notes: PublicNoteListItem.array() - }) + 200: contract.type<{ notes: PublicNoteListItem[] }>() }, summary: "List all notes" }, noteListsByDid: { method: "GET", path: "/:did/notes", - pathParams: type({ - did: "string" - }), - query: type({ - cursor: "string | undefined", - limit: "number | undefined" - }), + pathParams: contract.type<{ did: string }>(), + query: contract.type<{ cursor?: string; limit?: number }>(), responses: { - 200: type({ - notes: PublicNoteListItem.array() - }) + 200: contract.type<{ notes: PublicNoteListItem[] }>() }, summary: "List all notes" } diff --git a/src/shims-vue.d.ts b/src/shims-vue.d.ts index 6daf038..e410c28 100644 --- a/src/shims-vue.d.ts +++ b/src/shims-vue.d.ts @@ -1,3 +1,9 @@ +declare module '*.vue' { + import type { DefineComponent } from 'vue' + const component: DefineComponent<{}, {}, any> + export default component +} + declare module "pouchdb-adapter-indexeddb" declare module "@toycode/markdown-it-class" declare module "markdown-it-block-embed"