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

Added lang specifier to script tag, i.e., lang='typescript' #1411

Merged
merged 1 commit into from
Oct 27, 2020

Conversation

kayodebristol
Copy link
Contributor

@kayodebristol kayodebristol commented Oct 26, 2020

Changes

Targets app-template-svelte-typescript.
Adds language specifier to script block. This signals the svelte language server to process the enclosed based on the specified attribute, typescript, in this case.
See svelte language server docs for more info.

Testing

Tested in started project with vscode and svelte for vscode plugin. Warnings related to types disappeared.

Docs

No docs added. Template enhancement/bug fix.

@vercel
Copy link

vercel bot commented Oct 26, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pikapkg/snowpack/2rhifyxwf
✅ Preview: https://snowpack-git-master.pikapkg.vercel.app

Copy link
Collaborator

@drwpow drwpow left a comment

Choose a reason for hiding this comment

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

I’m surprised this was missing. Thank you for fixing!

@@ -1,4 +1,4 @@
<script>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn’t Svelte recommend lang="ts" instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I put some thought into it. I went with typescript because for someone just starting out it takes fewer cycles to process than lang="ts". Svelte favors ts because it's shorter. I think templates should be more instructional than optimal, but I'm happy to change it to whatever you prefer.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the explanation! To be clear: I was asking as a Svelte novice, and genuinely didn’t know 🙂. I too favor the clarity of typescript now that you’ve explained it. Happy to merge.

@drwpow drwpow merged commit eb51fa0 into FredKSchott:master Oct 27, 2020
peterhpchen pushed a commit to peterhpchen/snowpack that referenced this pull request Oct 31, 2020
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.

2 participants