#svelte now officially supports #ts!
TypeScript support in Svelte has been possible for a long time, but you had to mix a lot of disparate tools together and each project ran independently. Today, nearly all of these tools live under the Svelte organization and are maintained by a set of people who take responsibility over the whole pipeline and have common goals.
When we say that Svelte now supports TypeScript, we mean a few different things:
- You can use TypeScript inside your
<script> blocks — just add the lang="ts" attribute- Components with TypeScript can be type-checked with the
svelte-check command- You get autocompletion hints and type-checking as you're writing components, even in expressions inside markup
- TypeScript files understand the Svelte component API — no more red squiggles when you import a
.svelte file into a .ts modulehttps://svelte.dev/blog/svelte-and-typescript