From 80168636d92d60e8ca5ab04975178ee039740ecd Mon Sep 17 00:00:00 2001 From: Orta Date: Fri, 17 Jul 2020 17:11:14 -0400 Subject: [PATCH] Handle all the feedback in the PR --- .../blog/2020-06-04-svelte-and-typescript.md | 60 ++++++++++++------- 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/site/content/blog/2020-06-04-svelte-and-typescript.md b/site/content/blog/2020-06-04-svelte-and-typescript.md index a652386651..7d75411e8a 100644 --- a/site/content/blog/2020-06-04-svelte-and-typescript.md +++ b/site/content/blog/2020-06-04-svelte-and-typescript.md @@ -5,20 +5,41 @@ author: Orta Therox authorURL: https://twitter.com/orta --- -It's been on the TODO list for a while, and it's now happening. TypeScript with Svelte is now a first class citizen of the ecosystem. +It's been by far the most requested feature for a while, and it's finally here: Svelte officially supports TypeScript. -We think it'll help you handle much larger Svelte code bases regardless of whether you use TypeScript or JavaScript. +We think it'll give you a much nicer development experience — one that also scales beautifully to larger Svelte code bases — regardless of whether you use TypeScript or JavaScript.
Screenshot of TypeScript in Svelte
Image of TypeScript + Svelte in VS Code (theme is Kary Pro.)
+ +## Try it now + +You can start a new Svelte TypeScript project using the [normal template](https://github.com/sveltejs/template) and by running `node scripts/setupTypeScript.js` before you do anything else: + +```bash +npx degit sveltejs/template svelte-typescript-app +cd svelte-typescript-app +node scripts/setupTypeScript.js +``` + +If you're a VS Code user, make sure you're using the (new) [official extension](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode), which replaces the popular extension by James Birtles. +Later in this blog post, we'll detail the individual steps involved in using TypeScript in an existing Svelte project. + ## What does it mean to support TypeScript in Svelte? 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. -A week before COVID was declared a pandemic, [I pitched a consolidation](https://github.com/sveltejs/svelte/issues/4518) of the best Svelte tools and ideas from similar dev-ecosystems and provided a set of steps to get TypeScript support first class. Since then, many people have pitched in and wrote the code to get us there. +A week before COVID was declared a pandemic, [I pitched a consolidation](https://github.com/sveltejs/svelte/issues/4518) of the best Svelte tools and ideas from similar dev-ecosystems and provided a set of steps to get first class TypeScript support. Since then, many people have pitched in and written the code to get us there. + +When we say that Svelte now supports TypeScript, we mean a few different things: + +* You can use TypeScript inside your `