Svelte Typescript Unexpected Token Error

I’m trying to set a type on a variable and am receiving an error message only when running npm run dev. The error message says that there is an unexpected token, the colon(:), after my variable name. Here’s the error:

[vite] Internal server error: /auth.svelte:4:10 Unexpected token
Plugin: vite-plugin-svelte
File: /auth.svelte
2 | import { f7, Page, LoginScreenTitle, List, ListInput } from ‘framework7-svelte’;
3 |
4 | let email: string = ‘’;
^
5 | let password;
6 |

From what I understand, Vite should automatically compile Typescript and it seems to be doing so in other areas of my project. Does anyone have an idea of how to solve this issue?

1 Like

Seeing the same thing here, cannot figure out how to get everything to behave. Tried to get a svelte.config.js file going, but am running into issues there as well.