hperrin / svelte-material-ui

Svelte Material UI Components
https://sveltematerialui.com/
Apache License 2.0
3.28k stars 288 forks source link

Using data-attributes on components returns type error #581

Open TGlide opened 1 year ago

TGlide commented 1 year ago

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)


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

**Screenshots**
![image](https://user-images.githubusercontent.com/26071571/229555054-c65c7116-408d-430c-89dd-b85130de95cf.png)

**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
Suyashtnt commented 1 year ago

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

TGlide commented 1 year ago

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

rsmarples commented 10 months ago

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

rsmarples commented 10 months ago

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