svelte-material-ui icon indicating copy to clipboard operation
svelte-material-ui copied to clipboard

Using data-attributes on components returns type error

Open TGlide opened this issue 1 year ago • 4 comments

Describe the bug Trying to use a data-attribute on a component using Typescript returns a type error.

To Reproduce Steps to reproduce the behavior:

  1. Import the Accordion component within a <script lang="ts" /> block
  2. Use it as so: <Accordion data-state="123" />
  3. Run svelte-check
  4. See error:
  Object literal may only specify known properties, and '"data-state"' does not exist in type '{ getElement?: (() => HTMLDivElement) | undefined; use?: ActionArray | undefined; class?: string | undefined; multiple?: boolean | undefined; cite?: string | null | undefined; ... 319 more ...; 'sveltekit:reload'?: true | ... 1 more ... | undefined; }'. (ts)

<Accordion data-state="123" />

Expected behavior I expect to be able to use data-attributes on a Typescript environment without errors

Screenshots image

Desktop (please complete the following information):

  • OS: Windows 10 WSL Ubuntu
  • Browser N/A
  • Version N/A

Smartphone (please complete the following information): N/A

Additional context N/A

TGlide avatar Apr 03 '23 15:04 TGlide

I'm also getting this error. There is probably a way to tell typescript that it does exist

Suyashtnt avatar Apr 28 '23 09:04 Suyashtnt

I'm also getting this error. There is probably a way to tell typescript that it does exist

I think this is probably something to do with the Svelte Language Server

TGlide avatar Apr 28 '23 13:04 TGlide

Anyone found a good workaround for this yet? We're trying to upgrade to latest smui and this is blocking us :/

rsmarples avatar Sep 07 '23 09:09 rsmarples

Svelte issue: https://github.com/sveltejs/language-tools/issues/1825

rsmarples avatar Sep 08 '23 12:09 rsmarples