Skip to content

Commit

Permalink
Merge pull request #25300 from storybookjs/fix-type-custom-stories
Browse files Browse the repository at this point in the history
Docs: Fix types in custom stories implementation snippet
(cherry picked from commit 7ecf05e)
  • Loading branch information
kylegach authored and storybook-bot committed Jan 25, 2024
1 parent 738aafe commit 7ab3442
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/snippets/common/main-config-stories-with-logic.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@

// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite)
import type { StorybookConfig } from '@storybook/your-framework';
import type { StoriesEntry } from '@storybook/types';

async function findStories() {
async function findStories(): Promise<StoriesEntry[]> {
// your custom logic returns a list of files
}

const config: StorybookConfig = {
framework: '@storybook/your-framework',
stories: async (list) => [
stories: async (list: StoriesEntry[]) => [
...list,
// 👇 Add your found stories to the existing list of story files
...(await findStories()),
Expand Down

0 comments on commit 7ab3442

Please sign in to comment.