4 ms·
I'm wondering how good Typescript support is. Can I use Typescript in the component script?
by wontoncc 7y ago
I'm wondering how good Typescript support is. Can I use Typescript in the component script?
- rich_harris 7y agoSort of, via preprocessing, but you won't get any real benefit from it at present. There are two barriers: the compiler itself needs to become TS-aware, and we need to teach editors like VSCode how to typecheck inside <script> blocks. It's very much on the radar (I'm a TS convert, personally — Svelte itself is written in TypeScript), we just need to get round to it. The version 3 rewrite was largely about laying the foundations for TS support.
- Vinnl 7y agoSvelte itself has been on my radar for quite a while - I think when proper TypeScript support lands, that will be the first time I'll actually give it a try for one project or another. The idea is intriguing, thanks for working on it!
- dbrgn 7y agoDo you have any estimate on how much work that'll be? Do you think you'll be able to land TS support (including type-checking through the command line) within half a year, or is that a bigger thing?
- farhan_ghazali 7y agoI've created two project as a POC for typescript support https://github.com/farhan2106/svelte-typescript https://github.com/farhan2106/svelte-typescript https://github.com/farhan2106/svelte-typescript-ssr https://github.com/farhan2106/svelte-typescript-ssr Basically, I separate out the <script> & <html> section into two files. The <script> part is generated from typescript and combined later before sending it into the svelte compiler. I am currently working on a gulp build file to streamline the process. Let me know what you think.
- deleted 7y ago[deleted]