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

Adding storybook shows Type '{ class: string; }' is not assignable to type error #178

Closed
abhic91 opened this issue Dec 13, 2021 · 5 comments

Comments

@abhic91
Copy link

abhic91 commented Dec 13, 2021

I added storybook to my vue project. Once I add I get error in vs code when I set class on an element.

When I do <div class=""></div> I get

Type '{ class: string; }' is not assignable to type 
'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'.
  Property 'class' does not exist on type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'. 
Did you mean 'className'?ts(2322)

When I hover over a div, I see

(property) div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>

in vs code.

This is a vue project with .vue file.

This happens only when I add storybook. To add storybook, the command I used is

npx sb@next init --builder storybook-builder-vite

I don't know what's making vs code assume the code is React

@IanVS
Copy link
Member

IanVS commented Dec 13, 2021

I believe this is related to storybookjs/storybook#16630, and not an issue with the builder itself.

@IanVS
Copy link
Member

IanVS commented Dec 13, 2021

Going to close this, but let me know if you think this is an issue in this project.

@abhic91
Copy link
Author

abhic91 commented Dec 14, 2021

@IanVS Adding this fixed it. See here: vuejs/language-tools#592

// tsconfig.json
{
  "compilerOptions": {
    // ...
    "types": [
      "vite/client", // if using vite
      // ...
    ]
  }
}

@khusseini
Copy link

Hi there, I am facing the same issue, however adding "vite/client" does not do the trick for me.

@IanVS
Copy link
Member

IanVS commented Jun 10, 2022

@khusseini can you please open a new issue and fill out the template?

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

No branches or pull requests

3 participants