Fixed type errors

This commit is contained in:
wires 2026-03-07 17:38:33 -05:00
parent 2b5ef38064
commit bf2d0c968a

View file

@ -1,7 +1,12 @@
<script module lang="ts">
import { defineMeta } from '@storybook/addon-svelte-csf';
import type { ComponentProps } from 'svelte';
import PhotoPack from './PhotoPack.svelte';
type StoryArgs = ComponentProps<typeof PhotoPack> & {
imageCount?: number;
};
const { Story } = defineMeta({
title: 'Components/Multimedia/PhotoPack',
component: PhotoPack,
@ -19,12 +24,6 @@
</script>
<script lang="ts">
import type { ComponentProps } from 'svelte';
type SmartDefaultsArgs = Omit<ComponentProps<typeof PhotoPack>, 'images'> & {
imageCount: number;
};
const defaultImages = [
{
src: 'https://graphics.thomsonreuters.com/cdn/django-tools/media/graphics-gallery/galleries/world-cup-2022/spain-germany-11-27/2022-11-27T194630Z_544493697_UP1E.jpeg',
@ -118,11 +117,11 @@
args={{
width: 'wide',
textWidth: 'normal',
// @ts-expect-error - imageCount is a custom arg for this story's template
// @ts-expect-error custom story arg, not a PhotoPack prop
imageCount: 4,
}}
argTypes={{
// @ts-expect-error - imageCount is a custom arg for this story's template
// @ts-expect-error custom story arg, not a PhotoPack prop
imageCount: {
control: { type: 'range', min: 2, max: 5, step: 1 },
description:
@ -130,8 +129,8 @@
},
}}
>
{#snippet children(args)}
{@const { imageCount, ...photoPackProps } = args as SmartDefaultsArgs}
{#snippet template(args)}
{@const { imageCount, ...photoPackProps } = args as StoryArgs}
<PhotoPack
{...photoPackProps}
images={allImages.slice(0, imageCount || 4)}