hperrin / svelte-material-ui

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

snackbar.open() TS issue #575

Closed pboguslawski closed 1 year ago

pboguslawski commented 1 year ago

Describe the bug Typescript marks snackbar.open() with issue

This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?
  Not all constituents of type 'NonNullable<boolean | (() => void) | null | undefined>' are callable.
    Type 'false' has no call signatures.

(does not break this function and snaskbar opening works fine regardless of this issue).

No such TS issue for snackbar.close().

To Reproduce Run any example with .open() from https://sveltematerialui.com/demo/snackbar/ in VSCode + SvelteKit plugin and TS enabled.

Expected behavior No TS issue for open() method.

hperrin commented 1 year ago

I don't know why it's doing this, and it didn't until recently... hmm...

hperrin commented 1 year ago

Btw, I'm using a workaround right now, just checking that typeof snackbar.open === 'function', but that's not ideal.

hperrin commented 1 year ago

Oh Jesus Christ. It's because open can be an HTML attribute.