I'm working on a new Svelte project using Typescript. I'm also using the svelte-mui component module which was not written in Typescript and does not have a types file. Whenever I try to use a component, VSCode highlights the component with annoying red squiggles because Typescript doesn't know about the svelte properties that are a part of the object. The project builds and runs fine, but I would like to figure out how to tell Typescript what type they are. I know all the components extend SvelteComponent but I don't know how to tell Typescript that.
<script>
import Button from 'svelte-mui';
</script>
<Button on:click={() => {console.log('Clicked')}}>My Button</Button>
The last line will be highlighted as an error in the editor.
How do I tell Typescript that Button extends SvelteComponent?
Edit: @tmdesigned
I followed the instructions in the link provided by tmdesigned below, but no dice. I'm new to Typescript so maybe I'm still doing something wrong. I ended up with a file located at
types\svelte-mui\index.d.ts
that contains
declare module 'svelte-mui' {
import { SvelteComponent } from "svelte/internal";
class Button extends SvelteComponent{}
export { Button }
}
but the error still persists.
import { SvelteComponent } from 'svelte/internal';