Search code examples
typescriptconfigstorybook

Storybook config in typescript


I would like to write storybook decorator. Is there any way to write it and preview.js in typescript?

I already succeeded in writing stories itself in TS, and now would like to write storybook config in TS.


Solution

  • I finally manage to make it works.

    • Configs directory should be added to include option of typescript preset and tsconfig.json
    • Set module resolution to "node", because for some reasons it got set to "classic" for config folder

    Also, main.js should stay JS file, because only after parsing main.js config, storybook able to use TS preset.