当我尝试使用此命令npx -p @storybook/cli sb init --type angular
将故事书添加到Angular Intershop项目中,然后运行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'.
您知道缺少什么吗?谢谢
Storybook Angular Intershop Error
我在demo.d.ts文件中有这个
declare module '@storybook/angular/demo' {
export const Button: any;
export const Welcome: any;
}
答案 0 :(得分:3)
只需使其“运行”即可,您可以尝试以下操作:
declare module '@storybook/angular/demo'
添加到src/typings.d.ts
。(编辑:包括正确的答案,以排除与玩笑类型的冲突)
答案 1 :(得分:2)
只需将“ ../src/setupJest.ts”添加到.storybook/tsconfig.json
中的“排除”数组中