vikignt/svelte-mui

Property '$on' does not exist on type 'unknown'.ts (2339) (typescript)

frederikhors opened this issue · 1 comments

Simply importing Button:

<Button on:click={testFunction}>My Button</Button>

I get this in VSCode:

Property '$on' does not exist on type 'unknown'.ts (2339)

I'm using typescript with <script lang="ts"></script> with svelte-preprocess.

Treat symptoms but not the disease.

declare module 'svelte-mui/src/Button.svelte' {
  interface OnEvent {
    (event: 'click', callback: (event: MouseEvent) => void): void
  }
  export default class Button {
    $$prop_def: {
      class?: string
      style?: any
      icon?: boolean
      fab?: boolean
      dense?: boolean
      raised?: boolean
      unelevated?: boolean
      outlined?: boolean
      shaped?: boolean
      color?: string
      ripple?: boolean
      toggle?: boolean
      active?: boolean
      fullWidth?: boolean
    }
    $on: OnEvent
  }
}

then import Button from 'svelte-mui/src/Button.svelte'