diff --git a/src/state/queries/threadgate/index.ts b/src/state/queries/threadgate/index.ts index 8aa9320814..87e6d6666c 100644 --- a/src/state/queries/threadgate/index.ts +++ b/src/state/queries/threadgate/index.ts @@ -138,7 +138,7 @@ export async function getThreadgateRecord({ }), ) - if (data.value && AppBskyFeedThreadgate.isRecord(data.value)) { + if (data.value && AppBskyFeedThreadgate.isValidRecord(data.value)) { return data.value } else { return null diff --git a/src/state/queries/threadgate/types.ts b/src/state/queries/threadgate/types.ts index 0cbea311cb..ac215199d2 100644 --- a/src/state/queries/threadgate/types.ts +++ b/src/state/queries/threadgate/types.ts @@ -3,4 +3,4 @@ export type ThreadgateAllowUISetting = | {type: 'nobody'} | {type: 'mention'} | {type: 'following'} - | {type: 'list'; list: unknown} + | {type: 'list'; list: string} diff --git a/src/state/queries/threadgate/util.ts b/src/state/queries/threadgate/util.ts index fdaa2671f1..c4eda74f47 100644 --- a/src/state/queries/threadgate/util.ts +++ b/src/state/queries/threadgate/util.ts @@ -37,11 +37,11 @@ export function threadgateRecordToAllowUISetting( const settings: ThreadgateAllowUISetting[] = threadgate.allow .map(allow => { let setting: ThreadgateAllowUISetting | undefined - if (allow.$type === 'app.bsky.feed.threadgate#mentionRule') { + if (AppBskyFeedThreadgate.isValidMentionRule(allow)) { setting = {type: 'mention'} - } else if (allow.$type === 'app.bsky.feed.threadgate#followingRule') { + } else if (AppBskyFeedThreadgate.isValidFollowingRule(allow)) { setting = {type: 'following'} - } else if (allow.$type === 'app.bsky.feed.threadgate#listRule') { + } else if (AppBskyFeedThreadgate.isValidListRule(allow)) { setting = {type: 'list', list: allow.list} } return setting @@ -65,11 +65,7 @@ export function threadgateAllowUISettingToAllowRecordValue( return undefined } - let allow: ( - | AppBskyFeedThreadgate.MentionRule - | AppBskyFeedThreadgate.FollowingRule - | AppBskyFeedThreadgate.ListRule - )[] = [] + let allow: Exclude = [] if (!threadgate.find(v => v.type === 'nobody')) { for (const rule of threadgate) {