From 8d464a05f34927cf1be39a066029cc8191d903df Mon Sep 17 00:00:00 2001 From: "shakespeare.diy" Date: Thu, 24 Sep 2026 19:46:27 +0700 Subject: [PATCH] fix: resolve pre-existing tsc errors blocking the test gate Two type errors (surfaced by `npm run test` / tsc --noEmit on a full toolchain; the in-browser bundler does not run tsc, so they were latent): - useCVMClient.ts: remove a malformed cast `spots as typeof spots & { tags; created_at }[]` feeding deduplicateByIdentity(). The intersection dropped pubkey/kind and broke the reassignment to `spots`. deduplicateAddressable() already returns the correct shape, so the cast was both wrong and unnecessary. - queryPersister.ts: import PersistedClient / Persister from @tanstack/query-persist-client-core (their canonical source) instead of @tanstack/react-query-persist-client, whose `export *` re-export tsc won't resolve for named type imports. Added the core package (5.102.8, matching the pinned wrapper) as an explicit dependency. Both are pre-existing issues on the branch, unrelated to the audit remediation commits. Co-authored-by: shakespeare.diy --- package-lock.json | 11 +++++++++++ package.json | 1 + src/hooks/useCVMClient.ts | 2 +- src/lib/queryPersister.ts | 6 +++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8859a85..6df6826 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,6 +58,7 @@ "@scure/bip32": "^2.0.1", "@scure/bip39": "1.6.0", "@tanstack/query-core": "^5.102.8", + "@tanstack/query-persist-client-core": "^5.102.8", "@tanstack/react-query": "^5.56.2", "@tanstack/react-query-persist-client": "^5.102.8", "@unhead/addons": "^2.0.10", @@ -3533,6 +3534,16 @@ "type": "github" } }, + "node_modules/@tanstack/query-persist-client-core": { + "version": "5.102.8", + "resolved": "https://registry.npmjs.org/@tanstack/query-persist-client-core/-/query-persist-client-core-5.102.8.tgz", + "integrity": "sha512-t3v4/D6ejo/BrPzM5gm/AT3c4CWPCxFa+0cIjAeHAeanGPG6rCjFS1hZnPZH/rf55qe3qYYgx5U6iBZMY1PQjA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/tannerlinsley", + "type": "github" + } + }, "node_modules/@tanstack/react-query": { "version": "5.75.1", "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.75.1.tgz", diff --git a/package.json b/package.json index 200c289..0361711 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "@scure/bip32": "^2.0.1", "@scure/bip39": "1.6.0", "@tanstack/query-core": "^5.102.8", + "@tanstack/query-persist-client-core": "^5.102.8", "@tanstack/react-query": "5.102.8", "@tanstack/react-query-persist-client": "5.102.8", "@unhead/addons": "^2.0.10", diff --git a/src/hooks/useCVMClient.ts b/src/hooks/useCVMClient.ts index 580b3e8..91c055f 100644 --- a/src/hooks/useCVMClient.ts +++ b/src/hooks/useCVMClient.ts @@ -362,7 +362,7 @@ export function useCVMClient() { // Collapse the same real-world spot re-posted under a different id/author // (coordinate dedupe above can't catch those). Keeps the freshest copy. - spots = deduplicateByIdentity(spots as typeof spots & { tags: string[][]; created_at: number }[]); + spots = deduplicateByIdentity(spots); if (params.difficulty && params.difficulty !== 'all') { spots = spots.filter( diff --git a/src/lib/queryPersister.ts b/src/lib/queryPersister.ts index 5ae256d..64934cb 100644 --- a/src/lib/queryPersister.ts +++ b/src/lib/queryPersister.ts @@ -27,10 +27,14 @@ */ import { get, set, del } from 'idb-keyval'; +// PersistedClient / Persister are defined in the persist-client CORE package. +// The React wrapper (@tanstack/react-query-persist-client) only re-exports them +// via `export *`, which tsc does not resolve for named *type* imports under +// this project's config — import them from the canonical source instead. import type { PersistedClient, Persister, -} from '@tanstack/react-query-persist-client'; +} from '@tanstack/query-persist-client-core'; import type { Query } from '@tanstack/react-query'; const IDB_KEY = 'skatespots:react-query-cache';