From 9f9d448829971c4aa5c5dba2c2f56f3b7a4da546 Mon Sep 17 00:00:00 2001 From: Rudy Fraser Date: Thu, 7 May 2026 11:32:37 -0400 Subject: [PATCH] Fix typecheck errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - AssemblyEmbed.tsx: a.font_semibold → a.font_semi_bold (4 occurrences) - feed.ts: import missing QueryKey type - react-query.tsx: type the dehydrate callback's query param explicitly, and reference QueryClient through @tanstack/react-query so the global declaration matches the QueryClient instance we create (the dependency tree has both @tanstack/query-core 5.25.0 and 5.90.20, so importing from query-core directly resolves to the wrong copy) - url-helpers.ts: psl 1.15 publishes types via top-level 'types' but blocks them with package.json 'exports'; map the path to the d.ts file, switch to namespace import (no default in the .d.ts), and narrow the parse() result with 'error' in hostnamep --- .../Embed/ExternalEmbed/AssemblyEmbed.tsx | 8 +++--- src/lib/react-query.tsx | 26 ++++++++++++------- src/lib/strings/url-helpers.ts | 4 +-- src/state/queries/feed.ts | 1 + tsconfig.json | 3 ++- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/components/Post/Embed/ExternalEmbed/AssemblyEmbed.tsx b/src/components/Post/Embed/ExternalEmbed/AssemblyEmbed.tsx index 6157ab91e..10692249d 100644 --- a/src/components/Post/Embed/ExternalEmbed/AssemblyEmbed.tsx +++ b/src/components/Post/Embed/ExternalEmbed/AssemblyEmbed.tsx @@ -325,7 +325,7 @@ export function AssemblyEmbed({ accessibilityRole="link" accessibilityLabel="Sign in to vote" accessibilityHint="Opens the assembly page to sign in and vote"> - + Sign in to vote @@ -459,7 +459,7 @@ export function AssemblyEmbed({ accessibilityRole="button" accessibilityLabel="Agree" accessibilityHint="Vote agree on this statement"> - + {voting ? '...' : 'Agree'} @@ -478,7 +478,7 @@ export function AssemblyEmbed({ accessibilityRole="button" accessibilityLabel="Disagree" accessibilityHint="Vote disagree on this statement"> - + {voting ? '...' : 'Disagree'} @@ -500,7 +500,7 @@ export function AssemblyEmbed({ {voting ? '...' : 'Pass / Unsure'} diff --git a/src/lib/react-query.tsx b/src/lib/react-query.tsx index ec657b6c4..b18d80592 100644 --- a/src/lib/react-query.tsx +++ b/src/lib/react-query.tsx @@ -1,7 +1,12 @@ import {useEffect, useRef, useState} from 'react' import {AppState, type AppStateStatus} from 'react-native' import {createAsyncStoragePersister} from '@tanstack/query-async-storage-persister' -import {focusManager, onlineManager, QueryClient} from '@tanstack/react-query' +import { + focusManager, + onlineManager, + type Query, + QueryClient, +} from '@tanstack/react-query' import { type PersistQueryClientOptions, PersistQueryClientProvider, @@ -17,7 +22,7 @@ import {IS_NATIVE, IS_WEB} from '#/env' declare global { interface Window { // eslint-disable-next-line @typescript-eslint/consistent-type-imports - __TANSTACK_QUERY_CLIENT__: import('@tanstack/query-core').QueryClient + __TANSTACK_QUERY_CLIENT__: import('@tanstack/react-query').QueryClient } } @@ -133,14 +138,15 @@ const createQueryClient = () => }, }) -const dehydrateOptions: PersistQueryClientProviderProps['persistOptions']['dehydrateOptions'] = - { - shouldDehydrateMutation: (_: any) => false, - shouldDehydrateQuery: query => { - const root = String(query.queryKey[0]) - return root === PERSISTED_QUERY_ROOT - }, - } +const dehydrateOptions: NonNullable< + PersistQueryClientProviderProps['persistOptions']['dehydrateOptions'] +> = { + shouldDehydrateMutation: (_: any) => false, + shouldDehydrateQuery: (query: Query) => { + const root = String(query.queryKey[0]) + return root === PERSISTED_QUERY_ROOT + }, +} export function QueryProvider({ children, diff --git a/src/lib/strings/url-helpers.ts b/src/lib/strings/url-helpers.ts index b8c2153f9..92163110c 100644 --- a/src/lib/strings/url-helpers.ts +++ b/src/lib/strings/url-helpers.ts @@ -1,5 +1,5 @@ import {AtUri} from '@atproto/api' -import psl from 'psl' +import * as psl from 'psl' import TLDs from 'tlds' import {BSKY_SERVICE} from '#/lib/constants' @@ -327,7 +327,7 @@ export function isPossiblyAUrl(str: string): boolean { export function splitApexDomain(hostname: string): [string, string] { const hostnamep = psl.parse(hostname) - if (hostnamep.error || !hostnamep.listed || !hostnamep.domain) { + if ('error' in hostnamep || !hostnamep.listed || !hostnamep.domain) { return ['', hostname] } return [ diff --git a/src/state/queries/feed.ts b/src/state/queries/feed.ts index c9d095a5a..287b5d746 100644 --- a/src/state/queries/feed.ts +++ b/src/state/queries/feed.ts @@ -14,6 +14,7 @@ import { type InfiniteData, keepPreviousData, type QueryClient, + type QueryKey, useInfiniteQuery, useMutation, useQuery, diff --git a/tsconfig.json b/tsconfig.json index 2f3d9354d..3f826e452 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,8 @@ "#/*": ["./src/*"], "crypto": ["./src/platform/crypto.ts"], "multiformats/cid": ["node_modules/multiformats/types/src/cid.d.ts"], - "multiformats/hashes/hasher": ["node_modules/multiformats/types/src/hashes/hasher.d.ts"] + "multiformats/hashes/hasher": ["node_modules/multiformats/types/src/hashes/hasher.d.ts"], + "psl": ["node_modules/psl/types/index.d.ts"] }, "plugins": [ { -- knotmirror 0.0.1