故事书在 Angular Intershop 项目中不起作用

Món*_*lgo 5 intershop angular storybook

当我尝试使用此命令将故事书添加到 Angular Intershop 项目npx -p @storybook/cli sb init --type angular然后运行时npm run storybook,它给了我这个错误:

ERROR in D:/angular-intershop/intershop-pwa/src/stories/0-Welcome.stories.ts
ERROR in D:/angular-intershop/intershop-pwa/src/stories/0-Welcome.stories.ts(1,25):
TS2307: Cannot find module '@storybook/angular/demo'.

ERROR in D:/angular-intershop/intershop-pwa/src/stories/1-Button.stories.ts
ERROR in D:/angular-intershop/intershop-pwa/src/stories/1-Button.stories.ts(4,24):
TS2307: Cannot find module '@storybook/angular/demo'.
Run Code Online (Sandbox Code Playgroud)

你知道缺少什么吗?谢谢

Storybook Angular Intershop 错误

我的 demo.d.ts 文件中有这个

declare module '@storybook/angular/demo' { export const Button: any; export const Welcome: any; }

Dan*_*ann 3

为了让它“工作”,你可以尝试以下操作:

  • 添加declare module '@storybook/angular/demo'src/typings.d.ts.
  • 将“../src/setupJest.ts”添加到 .storybook/tsconfig.json 中的“排除”数组中,以便 Storybook 忽略那里使用的类型

(编辑:包括排除与笑话类型冲突的正确答案)