From 3f8016139cacce5b6d0968eee57746df0a897e50 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 3 Aug 2026 15:57:24 +0300 Subject: [PATCH] cast branded params with the dedicated syntax types Co-Authored-By: Claude Fable 5 --- src/state/queries/actor-starter-packs.ts | 6 +++--- src/state/queries/known-followers.ts | 3 ++- src/state/queries/list-members.ts | 3 ++- src/state/queries/lists-with-membership.ts | 3 ++- src/state/queries/my-lists.ts | 4 ++-- src/state/queries/pinned-post.ts | 4 ++-- src/state/queries/profile-feedgens.ts | 3 ++- src/state/queries/profile-followers.ts | 3 ++- src/state/queries/profile-follows.ts | 3 ++- src/state/queries/profile-lists.ts | 3 ++- src/state/queries/suggested-follows.ts | 4 ++-- .../verification/useUpdateProfileVerificationCache.ts | 4 ++-- 12 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/state/queries/actor-starter-packs.ts b/src/state/queries/actor-starter-packs.ts index 29ebfd29c5..cef91c6bd6 100644 --- a/src/state/queries/actor-starter-packs.ts +++ b/src/state/queries/actor-starter-packs.ts @@ -1,3 +1,4 @@ +import {type DidString} from '@atproto/syntax' import {type QueryClient, useInfiniteQuery} from '@tanstack/react-query' import {useAppviewClient} from '#/state/session' @@ -25,7 +26,7 @@ export function useActorStarterPacksQuery({ queryFn: async ({pageParam}: {pageParam?: string}) => { return await client.call(app.bsky.graph.getActorStarterPacks, { // the enabled flag prevents this from running until did is set - actor: did! as app.bsky.graph.getActorStarterPacks.$Params['actor'], + actor: did! as DidString, limit: 10, cursor: pageParam, }) @@ -50,8 +51,7 @@ export function useActorStarterPacksWithMembershipsQuery({ queryFn: async ({pageParam}: {pageParam?: string}) => { return await client.call(app.bsky.graph.getStarterPacksWithMembership, { // the enabled flag prevents this from running until did is set - actor: - did! as app.bsky.graph.getStarterPacksWithMembership.$Params['actor'], + actor: did! as DidString, limit: 10, cursor: pageParam, }) diff --git a/src/state/queries/known-followers.ts b/src/state/queries/known-followers.ts index 0e0e8fb70a..3106456f9d 100644 --- a/src/state/queries/known-followers.ts +++ b/src/state/queries/known-followers.ts @@ -1,4 +1,5 @@ import {type AppBskyActorDefs} from '@atproto/api' +import {type DidString} from '@atproto/syntax' import { type InfiniteData, type QueryClient, @@ -28,7 +29,7 @@ export function useProfileKnownFollowersQuery(did: string | undefined) { async queryFn({pageParam}: {pageParam: RQPageParam}) { return await client.call(app.bsky.graph.getKnownFollowers, { // the enabled flag prevents this from running until did is set - actor: did! as app.bsky.graph.getKnownFollowers.$Params['actor'], + actor: did! as DidString, limit: PAGE_SIZE, cursor: pageParam, }) diff --git a/src/state/queries/list-members.ts b/src/state/queries/list-members.ts index 347c05d213..bde6666dc6 100644 --- a/src/state/queries/list-members.ts +++ b/src/state/queries/list-members.ts @@ -3,6 +3,7 @@ import { type AppBskyGraphDefs, type AtpAgent, } from '@atproto/api' +import {type AtUriString} from '@atproto/syntax' import { type InfiniteData, type QueryClient, @@ -37,7 +38,7 @@ export function useListMembersQuery(uri?: string, limit: number = PAGE_SIZE) { async queryFn({pageParam}: {pageParam: RQPageParam}) { return await client.call(app.bsky.graph.getList, { // the enabled flag will prevent this from running until uri is set - list: uri! as app.bsky.graph.getList.$Params['list'], + list: uri! as AtUriString, limit, cursor: pageParam, }) diff --git a/src/state/queries/lists-with-membership.ts b/src/state/queries/lists-with-membership.ts index ffe18cbfaa..1bd09704b9 100644 --- a/src/state/queries/lists-with-membership.ts +++ b/src/state/queries/lists-with-membership.ts @@ -1,4 +1,5 @@ import {type AppBskyActorDefs} from '@atproto/api' +import {type AtIdentifierString} from '@atproto/syntax' import { type InfiniteData, type QueryClient, @@ -37,7 +38,7 @@ export function useListsWithMembershipQuery({ queryFn: async ({pageParam}: {pageParam?: string}) => { return await client.call(app.bsky.graph.getListsWithMembership, { // the enabled flag prevents this from running until actor is set - actor: actor! as app.bsky.graph.getListsWithMembership.$Params['actor'], + actor: actor! as AtIdentifierString, limit: 50, cursor: pageParam, }) diff --git a/src/state/queries/my-lists.ts b/src/state/queries/my-lists.ts index 50c1e14b81..d4538104dd 100644 --- a/src/state/queries/my-lists.ts +++ b/src/state/queries/my-lists.ts @@ -1,4 +1,5 @@ import {type AppBskyGraphDefs} from '@atproto/api' +import {type DidString} from '@atproto/syntax' import {type QueryClient, useQuery} from '@tanstack/react-query' import {accumulate} from '#/lib/async/accumulate' @@ -27,8 +28,7 @@ export function useMyListsQuery(filter: MyListsFilter) { accumulate(cursor => client .call(app.bsky.graph.getLists, { - actor: currentAccount! - .did as app.bsky.graph.getLists.$Params['actor'], + actor: currentAccount!.did as DidString, cursor, limit: 50, }) diff --git a/src/state/queries/pinned-post.ts b/src/state/queries/pinned-post.ts index c2d6373f78..d132127e68 100644 --- a/src/state/queries/pinned-post.ts +++ b/src/state/queries/pinned-post.ts @@ -1,3 +1,4 @@ +import {type DidString} from '@atproto/syntax' import {msg} from '@lingui/core/macro' import {useLingui} from '@lingui/react' import {useMutation, useQueryClient} from '@tanstack/react-query' @@ -35,8 +36,7 @@ export function usePinnedPostMutation() { // get the currently pinned post so we can optimistically remove the pin from it if (!currentAccount) throw new Error('Not signed in') const profile = await client.call(app.bsky.actor.getProfile, { - actor: - currentAccount.did as app.bsky.actor.getProfile.$Params['actor'], + actor: currentAccount.did as DidString, }) prevPinnedPost = profile.pinnedPost?.uri if (prevPinnedPost && prevPinnedPost !== postUri) { diff --git a/src/state/queries/profile-feedgens.ts b/src/state/queries/profile-feedgens.ts index b61874157b..7bdcd62b64 100644 --- a/src/state/queries/profile-feedgens.ts +++ b/src/state/queries/profile-feedgens.ts @@ -1,4 +1,5 @@ import {moderateFeedGenerator} from '@atproto/api' +import {type DidString} from '@atproto/syntax' import { type InfiniteData, type QueryKey, @@ -33,7 +34,7 @@ export function useProfileFeedgensQuery( queryKey: RQKEY(did), async queryFn({pageParam}: {pageParam: RQPageParam}) { const data = await client.call(app.bsky.feed.getActorFeeds, { - actor: did as app.bsky.feed.getActorFeeds.$Params['actor'], + actor: did as DidString, limit: PAGE_SIZE, cursor: pageParam, }) diff --git a/src/state/queries/profile-followers.ts b/src/state/queries/profile-followers.ts index 23fe01aadd..5022ae9576 100644 --- a/src/state/queries/profile-followers.ts +++ b/src/state/queries/profile-followers.ts @@ -1,4 +1,5 @@ import {type AppBskyActorDefs} from '@atproto/api' +import {type DidString} from '@atproto/syntax' import { type InfiniteData, type QueryClient, @@ -51,7 +52,7 @@ export function useProfileFollowersQuery( * is `undefined`, hence the conditional spread. */ return await client.call(app.bsky.graph.getFollowers, { - actor: (did || '') as app.bsky.graph.getFollowers.$Params['actor'], + actor: (did || '') as DidString, limit: PAGE_SIZE, cursor: pageParam, ...(sortParam ? {sort: sortParam} : {}), diff --git a/src/state/queries/profile-follows.ts b/src/state/queries/profile-follows.ts index 6759be79b0..1cd857af16 100644 --- a/src/state/queries/profile-follows.ts +++ b/src/state/queries/profile-follows.ts @@ -1,4 +1,5 @@ import {type AppBskyActorDefs} from '@atproto/api' +import {type DidString} from '@atproto/syntax' import { type InfiniteData, type QueryClient, @@ -56,7 +57,7 @@ export function useProfileFollowsQuery( * is `undefined`, hence the conditional spread. */ return await client.call(app.bsky.graph.getFollows, { - actor: (did || '') as app.bsky.graph.getFollows.$Params['actor'], + actor: (did || '') as DidString, limit: limit || PAGE_SIZE, cursor: pageParam, ...(sortParam ? {sort: sortParam} : {}), diff --git a/src/state/queries/profile-lists.ts b/src/state/queries/profile-lists.ts index cb9f8e79f3..0237876513 100644 --- a/src/state/queries/profile-lists.ts +++ b/src/state/queries/profile-lists.ts @@ -1,4 +1,5 @@ import {moderateUserList} from '@atproto/api' +import {type DidString} from '@atproto/syntax' import { type InfiniteData, type QueryKey, @@ -29,7 +30,7 @@ export function useProfileListsQuery(did: string, opts?: {enabled?: boolean}) { queryKey: RQKEY(did), async queryFn({pageParam}: {pageParam: RQPageParam}) { return await client.call(app.bsky.graph.getLists, { - actor: did as app.bsky.graph.getLists.$Params['actor'], + actor: did as DidString, limit: PAGE_SIZE, cursor: pageParam, }) diff --git a/src/state/queries/suggested-follows.ts b/src/state/queries/suggested-follows.ts index d33120cebb..12f726baea 100644 --- a/src/state/queries/suggested-follows.ts +++ b/src/state/queries/suggested-follows.ts @@ -1,5 +1,6 @@ import {useCallback, useMemo} from 'react' import {type AppBskyActorDefs} from '@atproto/api' +import {type DidString} from '@atproto/syntax' import { type InfiniteData, type QueryClient, @@ -37,8 +38,7 @@ export function useSuggestedFollowsByActorQuery({ const data = await client.call( app.bsky.graph.getSuggestedFollowsByActor, { - actor: - did as app.bsky.graph.getSuggestedFollowsByActor.$Params['actor'], + actor: did as DidString, }, ) const suggestions = data.suggestions.filter( diff --git a/src/state/queries/verification/useUpdateProfileVerificationCache.ts b/src/state/queries/verification/useUpdateProfileVerificationCache.ts index 50b807209c..5a9d870d85 100644 --- a/src/state/queries/verification/useUpdateProfileVerificationCache.ts +++ b/src/state/queries/verification/useUpdateProfileVerificationCache.ts @@ -1,4 +1,5 @@ import {useCallback} from 'react' +import {type DidString} from '@atproto/syntax' import {useQueryClient} from '@tanstack/react-query' import {logger} from '#/logger' @@ -20,8 +21,7 @@ export function useUpdateProfileVerificationCache() { async ({profile}: {profile: bsky.profile.AnyProfileView}) => { try { const updated = await client.call(app.bsky.actor.getProfile, { - actor: (profile.did ?? - '') as app.bsky.actor.getProfile.$Params['actor'], + actor: (profile.did ?? '') as DidString, }) updateProfileShadow(qc, profile.did, { verification: updated.verification,