Skip to content

Commit

Permalink
Temporarily resolve existing type issues possibly related to `@storyb…
Browse files Browse the repository at this point in the history
…ook/svelte` on legacy
  • Loading branch information
xeho91 committed Oct 27, 2024
1 parent 92ca4db commit 6b646f1
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions tests/stories/Comparison.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const meta = {
// @ts-expect-error
component: Comparison,
argTypes: {
// @ts-expect-error
csf: { table: { disable: true } },
},
tags: ['autodocs', '!dev'],
Expand Down
4 changes: 3 additions & 1 deletion tests/stories/LegacyStory.stories.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Story, Template } from '@storybook/addon-svelte-csf';
import type { Meta } from '@storybook/svelte';
import LegacyStory from './LegacyTemplate.svelte';
import LegacyStory from './LegacyStory.svelte';
/**
* Description set explicitly in the comment above export const meta.
Expand All @@ -15,7 +15,9 @@
*/
export const meta = {
title: 'LegacyStory',
// @ts-expect-error FIXME: Needs invesigation on `@storybook/svelte` types
component: LegacyStory,
args: {},
tags: ['autodocs'],
} satisfies Meta<typeof LegacyStory>;
Expand Down
8 changes: 4 additions & 4 deletions tests/stories/LegacyStory.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
import type { HTMLButtonAttributes } from 'svelte/elements';
interface Props extends HTMLAttributes<HTMLButtonElement> {
interface $$Props extends HTMLButtonAttributes {
rounded?: boolean;
}
let { rounded = false, ...restProps }: Props = $props();
export let rounded = false;
</script>

<button class="button" class:rounded {...restProps}>
<button class="button" class:rounded {...$$restProps}>
<strong>{rounded ? 'Round' : 'Square'} corners</strong>
<hr />
</button>
Expand Down
1 change: 1 addition & 0 deletions tests/stories/LegacyTemplate.stories.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
export const meta = {
title: 'LegacyTemplate',
// @ts-expect-error FIXME: Needs invesigation on `@storybook/svelte` types
component: LegacyTemplate,
tags: ['autodocs'],
} satisfies Meta<typeof LegacyTemplate>;
Expand Down
2 changes: 1 addition & 1 deletion tests/stories/LegacyTemplate.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import type { HTMLButtonAttributes } from 'svelte/elements';
interface $$Props extends HTMLButtonAttributes {
interface $$Props extends Partial<HTMLButtonAttributes> {
rounded?: boolean;
}
Expand Down
5 changes: 3 additions & 2 deletions tests/stories/LegacyWithInstance.stories.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
export const meta = {
title: 'LegacyTemplateWithInstance',
// @ts-expect-error FIXME: Needs invesigation on `@storybook/svelte` types
component: LegacyTemplate,
tags: ['autodocs'],
} satisfies Meta<typeof LegacyTemplate>;
Expand All @@ -28,14 +29,14 @@

<Template let:args let:context>
<p>Using default template</p>
<LegacyTemplate {...args} onclick={handleClick} />
<LegacyTemplate {...args} on:click={handleClick} />
</Template>

<Story name="Default" />

<Template id="rounded" let:args>
<p>Using rounded template</p>
<LegacyTemplate {...args} onclick={handleClick} rounded />
<LegacyTemplate {...args} on:click={handleClick} rounded />
</Template>

<Story name="Rounded" template="rounded" />

0 comments on commit 6b646f1

Please sign in to comment.