#Types missing after switching to SB7 + Vite Builder

12 messages · Page 1 of 1 (latest)

blazing radish
#

I just tried upgrading Storybook to the SB7 beta and switched from webpack to the Vite builder.
So far so good, but I've lost all my generated type descriptions.
The config in main.ts showed errors with the typescript key. I've tried both with and without the config and either way the descriptions are gone and the controls aren't as accurate.
Here is the config if that's helpful:

typescript: {
    check: false,
    checkOptions: {},
    reactDocgen: 'react-docgen-typescript',
    reactDocgenTypescriptOptions: {
        shouldExtractLiteralValuesFromEnum: true,
        propFilter: (prop) =>
            prop.parent ? !/node_modules/.test(prop.parent.fileName) : true,
    },
},
distant verge
#

The types for main.ts don't include typescript in vite frameworks, but it should still work (we have an issue to add them). Any chance you could share a small reproduction?

distant verge
blazing radish
#

It's in a private repo, but if I can find some time, I'll put together a reproduction 👍

blazing radish
distant verge
#

I don't know why yet, but I found that moving the component+story into /apps/storybook and changing stories to point there, causes it to work. As it is in your repo, react-docgen-typescript isn't returning anything.

#

(You may also need to add a displayName to the component, since it's using forwardRef)

#

alright, got it

#

Add include: ['../../packages/ui/src/**/*.tsx'] to your reactDocgenTypescriptOptions

#

And then the repro works

blazing radish
#

Amazing, it works!
Thanks so much!