3 ms·
I recently experimented a bit with Svelte + TypeScript for Electron applications. When doing so I wrote down my notes in the form of a project tutorial: https:/
by dgellow 6y ago
I recently experimented a bit with Svelte + TypeScript for Electron applications. When doing so I wrote down my notes in the form of a project tutorial: https://sam.elborai.me/blog/electron-svelte-3-typescript-part-1 https://sam.elborai.me/blog/electron-svelte-3-typescript-par....
That may be of interest for some of you who would like to try Svelte.
- hatch_q 6y agoAre 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} />