From c624de76222aeb2954a3d2b2dca28fe4845d6fe8 Mon Sep 17 00:00:00 2001 From: Steven Vandevelde Date: Fri, 10 Apr 2026 17:07:13 +0200 Subject: [PATCH] fix: type errors --- src/components/output/raw/atproto/element.js | 10 ++++++---- src/components/supplement/rocksky/element.js | 2 +- src/facets/connect/common.js | 2 +- src/facets/data/playlists/index.inline.js | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/output/raw/atproto/element.js b/src/components/output/raw/atproto/element.js index 8ad3a34c..0b7a09f0 100644 --- a/src/components/output/raw/atproto/element.js +++ b/src/components/output/raw/atproto/element.js @@ -300,7 +300,7 @@ class ATProtoOutput extends BroadcastedOutputElement { if (!rpc) return; try { const result = await ok(rpc.get("com.atproto.repo.describeRepo", { - params: { repo: did }, + params: { repo: /** @type {import("@atcute/lexicons").ActorIdentifier} */ (did) }, })); if (this.#did.value === did) { this.#handle.value = result.handle ?? null; @@ -458,10 +458,11 @@ class ATProtoOutput extends BroadcastedOutputElement { try { const records = []; + /** @type {string | undefined} */ let cursor; do { const page = await ok(this.#rpc.get("com.atproto.repo.listRecords", { - params: { repo: did, collection, limit: 100, cursor }, + params: { repo: /** @type {import("@atcute/lexicons").ActorIdentifier} */ (did), collection: /** @type {`${string}.${string}.${string}`} */ (collection), limit: 100, cursor }, })); records.push(...page.records.map((r) => /** @type {T} */ (r.value))); cursor = page.cursor; @@ -585,14 +586,15 @@ class ATProtoOutput extends BroadcastedOutputElement { /** @type {Map} */ const existing = new Map(); + /** @type {string | undefined} */ let cursor; do { const page = await ok(rpc.get("com.atproto.repo.listRecords", { - params: { repo: did, collection, limit: 100, cursor }, + params: { repo: did, collection: /** @type {`${string}.${string}.${string}`} */ (collection), limit: 100, cursor }, })); for (const { uri, value } of page.records) { const record = /** @type {any} */ (value); - const rkey = uri.split("/").at(-1); + const rkey = /** @type {string} */ (uri.split("/").at(-1)); existing.set(record.id, { rkey, value: record }); } cursor = page.cursor; diff --git a/src/components/supplement/rocksky/element.js b/src/components/supplement/rocksky/element.js index f56d853d..941a7aeb 100644 --- a/src/components/supplement/rocksky/element.js +++ b/src/components/supplement/rocksky/element.js @@ -201,7 +201,7 @@ class RockskyScrobbler extends BroadcastableDiffuseElement { }; if (tags.track?.no != null) record.trackNumber = tags.track.no; - if (tags.disk?.no != null) record.discNumber = tags.disk.no; + if (tags.disc?.no != null) record.discNumber = tags.disc.no; record.createdAt = new Date(startedAt).toISOString(); diff --git a/src/facets/connect/common.js b/src/facets/connect/common.js index 4b3f5ddd..65c75e3e 100644 --- a/src/facets/connect/common.js +++ b/src/facets/connect/common.js @@ -16,7 +16,7 @@ import { html, nothing, render as litRender } from "lit-html"; * @param {Object} config * @param {string} config.title - Card header title * @param {TemplateResult | string} config.description - Content shown on the left side - * @param {TemplateResult} [config.rightContent] - Extra content shown at the top of the right side + * @param {TemplateResult | typeof nothing} [config.rightContent] - Extra content shown at the top of the right side * @param {TemplateResult} config.formFields - Form body content (inputs, footnotes, etc.) * @param {(mode: 'input' | 'output') => Promise} config.onSubmit * @param {boolean} [config.hasInput] - Whether to show the "Add audio input" button (default: true) diff --git a/src/facets/data/playlists/index.inline.js b/src/facets/data/playlists/index.inline.js index 7b5136e4..004cb56d 100644 --- a/src/facets/data/playlists/index.inline.js +++ b/src/facets/data/playlists/index.inline.js @@ -152,10 +152,10 @@ async function removeDuplicates(name, items) { */ function showDetails(name, tracks, items) { const seenIds = new Set(); - const found = items + const found = /** @type {Track[]} */ (items .map((item) => tracks.find((t) => Playlist.match(t, item))) .filter((t) => t != null && !seenIds.has(t.id) && seenIds.add(t.id)) - .sort((a, b) => (a.tags?.title ?? "").localeCompare(b.tags?.title ?? "")); + .sort((a, b) => (a?.tags?.title ?? "").localeCompare(b?.tags?.title ?? ""))); const notFound = items .filter((item) => !tracks.some((t) => Playlist.match(t, item))) -- 2.51.2