3 ms·
Are there type definitions available for svelte?
by hatch_q 6y ago
Are there type definitions available for svelte?
- Ciantic 6y agoYes. Svelte 3 is built with TypeScript in mind. Although since it was not originally built with that in mind it might still have some janky stuff, like some refactoring does not work.
- dgellow 6y agoYep! The simplest way to get a typescript setup is via https://github.com/sveltejs/template https://github.com/sveltejs/template. $ npx degit sveltejs/template svelte-app $ cd svelte-app $ node scripts/setupTypeScript.js $ npm install $ npm run dev Then you're good to go. When you define a <script></script> block in a Svelte file, just be sure to specify the attribute lang="ts". In VSCode with the svelte extension you get intellisense based on types info. <script lang="ts"> let name: string </script> <input bind:value={name} />