Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: can't pass tags array to CSF default export when is generated from a function (v7 AND v8) #26940

Open
YossiSaadi opened this issue Apr 24, 2024 · 0 comments

Comments

@YossiSaadi
Copy link
Contributor

YossiSaadi commented Apr 24, 2024

Describe the bug

Note: I'm using v7 for now, would love to have the possibility to fix it also for v7 please 馃檹

If you have a function

import { Tag } from '@storybook/types';
export function createMetaSettings(): { tags: Tag[] } {
  return { tags: ['a', 'b'] };
}

And you try to use it as:

import { createMetaSettings } from './createMetaSettings';

const metaSettings = createMetaSettings();
export default {
  // ...everythingElse,
  tags: metaSettings.tags,
}

you always get the error:

馃毃 Unable to index ./src/stories/MyStory.stories.ts:
WARN Error: CSF: Expected tags array

When I print the content of metaSettings.tags I always see that it is an array.

To Reproduce

Here's a reproduction through storybook.new
Happens both on v7 and v8 of SB.
Check out the Header.stories.ts which uses the external function.

https://stackblitz.com/edit/github-cm2fqj?file=src%2Fstories%2FHeader.stories.ts

System

Has nothing to do with system, happens on CSB, StackBlitz, and locally.

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant