Search code examples
reactjstypescriptcreate-react-appstorybook

How to allow storybook to build even with TypeScript (type) errors?


I've set up CRA typescript template and integrated storybook into the app. I'm using Chakra-UI which lacks typescript support for a few components right now. When I run yarn storybook, the app runs and serves up the storybook app and all the component stories work fine. When I build though, with the command yarn build-storybook, the TypeScript errors show up in the console and the command exits with exit code 1 and the build never happens. How do I set a configuration such that even thought there are TS errors, storybook still proceeds with the build?

Sample error below.

enter image description here


Solution

  • Storybook v6.1+ ./storybook/main.(js/ts)

    module.exports = {
        typescript: {
            check: false
        }
        ...
    }
    

    source: https://storybook.js.org/docs/react/configure/typescript