I have a Svelte project that uses Vite as the build tool, and I’m trying to import a TypeScript interface(toDo) in a Svelte component. However, I’m getting an error when I try to compile the component
Here’s what my Svelte component looks like:
<script type="ts">
import { toDo } from "./todos.store";
</script>
in this code snippet toDo is the type assigned to a toDoItem.
Any ideas on what might be causing this error and how I can fix it?
>Solution :
Change your type='ts' to lang='ts', and if you’re importing a type it’s good practice to specify that such like:
import type { toDo } from "./todos.store";