Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial stab at a TypeScript blog post #5101

Merged
merged 14 commits into from
Jul 21, 2020
Merged

Initial stab at a TypeScript blog post #5101

merged 14 commits into from
Jul 21, 2020

Conversation

orta
Copy link
Contributor

@orta orta commented Jul 4, 2020

Adds a post covering and giving credit to all the folks involved in the editor support.

@orta
Copy link
Contributor Author

orta commented Jul 4, 2020

Draft-y because I'd like @halfnelson @kaisermann @dummdidumm and @jasonlyu123 to take a look over

@pngwn
Copy link
Member

pngwn commented Jul 4, 2020

Looks good to me, tone feels good. Might be nice to get some more eyes on. @Conduitry @antony

@Rich-Harris Do you think this should coincide with a broader announcement on twitter?

@orta
Copy link
Contributor Author

orta commented Jul 4, 2020

I err, also didn't test that diff works in the site's markdown processor

@pngwn
Copy link
Member

pngwn commented Jul 4, 2020

Can't remember if that is a default with Prismjs, if not we'll need to add it in site-kit which is when the fun starts.

@pngwn
Copy link
Member

pngwn commented Jul 4, 2020

Of course it doesn't.

@orta
Copy link
Contributor Author

orta commented Jul 4, 2020

I can do it another way, it's just a good visual shortcut 👍 no need to do werk

@pngwn
Copy link
Member

pngwn commented Jul 4, 2020

Opened a PR to get this in, it will need merging and publishing before it works.

sveltejs/site-kit#21

We may also need to add:

import 'prismjs/components/prism-diff';

To site/src/utils/highlight.js, depends whether Prism automatically loads diff which I still don't know.

I think this is valuable anyway, don't worry about the extra work.

Copy link
Member

@kaisermann kaisermann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👌 it's finally here 😭

Copy link
Member

@antony antony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only nitpicks really. I love the tone.

site/content/blog/2020-06-04-svelte-and-typescript.md Outdated Show resolved Hide resolved
site/content/blog/2020-06-04-svelte-and-typescript.md Outdated Show resolved Hide resolved
Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! Some nit-picks, but that's all.

orta and others added 2 commits July 5, 2020 07:19
Co-authored-by: halfnelson <dpershouse@gmail.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
@kierangilliam
Copy link

Thanks for the write up! Going through it I spotted that this may need the import name of autoPreprocess instead of preprocess.

image

@kierangilliam
Copy link

Also for dumb people like myself, you may want to include typescript within the dependencies.

Side note, not sure if this is a bug that I was experiencing because I'm using routify or what...

image

... but basically I have to install postcss to use typescript. Any ideas why this is?

@kaisermann
Copy link
Member

kaisermann commented Jul 7, 2020

@kierangilliam Can you post your issue in the svelte-preprocess repo? Fixed in v4.0.1. It's completely unrelated to this pull request 😁

@orta
Copy link
Contributor Author

orta commented Jul 7, 2020

Thanks folks, updated from feedback!

@benmccann
Copy link
Member

3 out of 4 PRs necessary for Sapper TypeScript support have been merged and released. If the last one is able to be given a final review, perhaps we could announce Sapper TypeScript support as well.

@orta orta mentioned this pull request Jul 15, 2020
@opensas
Copy link
Contributor

opensas commented Jul 15, 2020

Really nice post. Perhaps you could add something like a tldr; paragraph for the anxious people, right before What does it mean to support TypeScript in Svelte?with the npx degit and node scripts/updateTypeScriptVersion.js

Copy link
Member

@Rich-Harris Rich-Harris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wonderful! I made a few inline suggestions. We might also want to rename this file so that the date is more reflective of when it goes live 😀

The post ends quite abruptly — I wonder if we should tack on a couple of pars?

## What about TypeScript in Sapper projects?

Watch this space!

## How can I contribute?

We're so glad you asked. The work is happening in the [sveltejs/language-tools](https://github.com/sveltejs/language-tools) — if you'd like to report issues, submit fixes, or help out with extensions for new editors and so on, that's where to go. See you there!

site/content/blog/2020-06-04-svelte-and-typescript.md Outdated Show resolved Hide resolved
site/content/blog/2020-06-04-svelte-and-typescript.md Outdated Show resolved Hide resolved
site/content/blog/2020-06-04-svelte-and-typescript.md Outdated Show resolved Hide resolved
<img alt="Screenshot of TypeScript in Svelte" src="media/svelte-ts.png">
<figcaption>Image of TypeScript + Svelte in VS Code (theme is <a href="https://marketplace.visualstudio.com/items?itemName=karyfoundation.theme-karyfoundation-themes">Kary Pro</a>.)</figcaption>
</figure>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a lot of people will want to just try it out straight away, so here (above the fold) would be a good place to have the quickstart guide

Suggested change
## Try it now
You can start a new Svelte TypeScript project using the [normal template](https://github.com/sveltejs/template) by running `node scripts/setupTypeScript.js` before you do anything else:
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.

(side-note: how do you put code blocks inside a commit suggestion...?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly by giving the suggestion language 4 backticks instead of 3. But don't quote me on this.

Copy link
Contributor Author

@orta orta Jul 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This week I learned how:

GFMarkdown allows for the code fences to be an arbitrary size. Here I'm using four on the outer one:

```ts

```

site/content/blog/2020-06-04-svelte-and-typescript.md Outdated Show resolved Hide resolved
site/content/blog/2020-06-04-svelte-and-typescript.md Outdated Show resolved Hide resolved
site/content/blog/2020-06-04-svelte-and-typescript.md Outdated Show resolved Hide resolved
site/content/blog/2020-06-04-svelte-and-typescript.md Outdated Show resolved Hide resolved
site/content/blog/2020-06-04-svelte-and-typescript.md Outdated Show resolved Hide resolved
site/content/blog/2020-06-04-svelte-and-typescript.md Outdated Show resolved Hide resolved
@wtho
Copy link

wtho commented Jul 17, 2020

The post is great!
One more thing - when I read through it for the first time, I ran the script but still wanted to apply the changes in the paragraph Adding Typescript... manually. I realized the steps were already applied, but only after going opening the project files.

I think it would be great to reference the script once more at the start of the file changes explanation.

@Rich-Harris Rich-Harris merged commit f615200 into master Jul 21, 2020
Truffula pushed a commit to Truffula/svelte that referenced this pull request Aug 3, 2020
* Initial stab at a blog post

* Update site/content/blog/2020-06-04-svelte-and-typescript.md

Co-authored-by: pngwn <hello@pngwn.io>

* Update 2020-06-04-svelte-and-typescript.md

* Apply suggestions from code review

Co-authored-by: halfnelson <dpershouse@gmail.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>

* Tighten the post

* Fix degit sample

* Feedback

* More feeedback

* Handle feedback

* Handle all the feedback in the PR

* Add a note about the should work

* Change date

* code style consistency, fix syntax error

Co-authored-by: pngwn <hello@pngwn.io>
Co-authored-by: halfnelson <dpershouse@gmail.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
taylorzane pushed a commit to taylorzane/svelte that referenced this pull request Dec 17, 2020
* Initial stab at a blog post

* Update site/content/blog/2020-06-04-svelte-and-typescript.md

Co-authored-by: pngwn <hello@pngwn.io>

* Update 2020-06-04-svelte-and-typescript.md

* Apply suggestions from code review

Co-authored-by: halfnelson <dpershouse@gmail.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>

* Tighten the post

* Fix degit sample

* Feedback

* More feeedback

* Handle feedback

* Handle all the feedback in the PR

* Add a note about the should work

* Change date

* code style consistency, fix syntax error

Co-authored-by: pngwn <hello@pngwn.io>
Co-authored-by: halfnelson <dpershouse@gmail.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
@Conduitry Conduitry deleted the ts-post branch October 7, 2021 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.