Typescript errors
Closed this issue · 6 comments
Hello,
During the storybook build, I have the following errors when I don't use semicolons in my code.
ERROR in [at-loader] ./src/components/title/index.tsx:41:25
TS1005: ';' expected.
ERROR in [at-loader] ./src/components/title/index.tsx:51:1
TS1005: 'try' expected.
ERROR in [at-loader] ./src/components/title/index.tsx:14:7
TS6133: 'Title' is declared but its value is never read.
ERROR in [at-loader] ./src/components/title/index.tsx:41:16
TS2304: Cannot find name 'Titletry'.
In this case, I solved the issue by adding semicolons to title/index.tsx
.
If I remove react-docgen-typescript-loader
, it "works" too but it's not the goal. :)
My storybook config is identical to that presented in the official storybook doc.
An idea?
Thx in advance.
One solution would be to run prettier on save or before compilation. I haven't tried it yet myself. What I did instead was to set an eslint rule to enforce semicolons (which I'd rather not do, but it prevents this issue).
Can someone provide a reproduction for this? If I had to guess, there’s a minor Webpack tweak that can be done to resolve this.
I came across the same problem,
You can see my config here: storybookjs/storybook#10395 (comment)
Sorry for the late response. I finally stopped using storybook, but the config of @balazsorban44 is very close to mine and I had exactly the same error.
I encountered same problem.
Solved this problem by add newline at the end of files.
So I put eol-last
rule into eslint.
I think it should also work for those who don't like use eol-last rule. So I create a fix by adding a \n between the sourcefile and the try-catch block.