Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I wrote a switch component in storybook. He would report an error #13546

Closed
lisen6 opened this issue Jan 3, 2021 · 3 comments
Closed

When I wrote a switch component in storybook. He would report an error #13546

lisen6 opened this issue Jan 3, 2021 · 3 comments

Comments

@lisen6
Copy link

lisen6 commented Jan 3, 2021

Describe the bug
When I wrote a switch component in storybook. He would report an error。
Such as:

ERROR in ./src/components/Switch/switch.tsx
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/antd-with-ts/src/components/Switch/switch.tsx: Unexpected token, expected "(" (90:10)
catch (__react_docgen_typescript_loader_error) { }try {
  89 |     // @ts-ignore
> 90 |     switch.displayName = "switch";

To Reproduce
Steps to reproduce the behavior:

interface SwitchProps{}
export const Switch:FC<SwitchProps> = (props) => {
  return <>something</>
}
export default Switch

in switch.stories.tsx

storiesOf("Switch component", module).add('Switch", () => <Switch />);

This component will report errors when used in storybook

Expected behavior
Should nothing go wrong

Screenshots
If applicable, add screenshots to help explain your problem.

Code snippets
If applicable, add code samples to help explain your problem.

System
Please paste the results of npx sb@next info here.

Additional context
Version of packages I use

  1. "typescript": "4.0.3"
  2. "@storybook/react": "^6.1.11",
  3. "babel-loader": "8.1.0",
@radihuq
Copy link

radihuq commented Jan 20, 2021

Related: #11419

@lisen6
Copy link
Author

lisen6 commented Jan 27, 2021

Related: #11419

thanks

@shilman
Copy link
Member

shilman commented Feb 21, 2021

closing as dupe to #11980

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants