打字稿中的故事书配置 [英] Storybook config in typescript

查看:53
本文介绍了打字稿中的故事书配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写故事书装饰器.有没有办法在打字稿中编写它和 preview.js ?

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

我已经在 TS 中成功地编写了故事本身,现在想在 TS 中编写故事书配置.

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

推荐答案

我终于成功了.

  • 应添加配置目录以包含打字稿预设和 tsconfig.json 的选项
  • 将模块分辨率设置为node",因为出于某些原因它被设置为经典"配置文件夹

另外,main.js应该是JS文件,因为只有解析main.js配置后,storybook才能使用TS预设.

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

这篇关于打字稿中的故事书配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆