docs(plan): Task 13 — match the type-safety fixes applied in Task 12
page.params.id is string|undefined in SvelteKit types; use ?? ''. TanStack Query's error is typed as Error; cast through unknown to ApiError. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1631,13 +1631,13 @@ Expected: FAIL — component not found.
|
|||||||
import { FALLBACK_COVER } from '$lib/media/covers';
|
import { FALLBACK_COVER } from '$lib/media/covers';
|
||||||
import type { ApiError } from '$lib/api/client';
|
import type { ApiError } from '$lib/api/client';
|
||||||
|
|
||||||
const id = $derived(page.params.id);
|
const id = $derived(page.params.id ?? '');
|
||||||
const queryStore = $derived(createAlbumQuery(id));
|
const queryStore = $derived(createAlbumQuery(id));
|
||||||
const query = $derived($queryStore);
|
const query = $derived($queryStore);
|
||||||
const showSkeleton = useDelayed(() => query.isPending);
|
const showSkeleton = useDelayed(() => query.isPending);
|
||||||
|
|
||||||
const notFound = $derived(
|
const notFound = $derived(
|
||||||
query.isError && (query.error as ApiError | undefined)?.code === 'not_found'
|
query.isError && (query.error as unknown as ApiError | undefined)?.code === 'not_found'
|
||||||
);
|
);
|
||||||
|
|
||||||
function onCoverError(e: Event) {
|
function onCoverError(e: Event) {
|
||||||
|
|||||||
Reference in New Issue
Block a user