question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
IanVScommented, Jun 10, 2022

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

1reaction
abhic91commented, Dec 14, 2021

@IanVS Adding this fixed it. See here: johnsoncodehk/volar#592

// tsconfig.json
{
  "compilerOptions": {
    // ...
    "types": [
      "vite/client", // if using vite
      // ...
    ]
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

string; }' is not assignable to type 'DetailedHTMLProps ...
It works when I run the app but it's annoying to see that error in vscode. Am I supposed to add some d.ts...
Read more >
Adding storybook shows Type '{ class: string - Issuehunt
Adding storybook shows Type '{ class: string; }' is not assignable to type error #16998 ... Describe the bug I am using vue3/ts/vite/volar....
Read more >
Make JSX typings an optional install as they conflict ... - GitHub
When migrating from React to Vue, types should not fail without installing them. ... Type '{ class: string; }' is not assignable to...
Read more >
type 'void' is not assignable to type 'reactelement<any, any>
Error : Type 'void' is not assignable to type 'ReactNode' ... second problem is that a class decorator must return void or the...
Read more >
typescript-cheatsheet - GitHub Pages
Basic Assign Types. String. Another fundamental part of creating programs in JavaScript for webpages and servers alike is working with textual data. As...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found