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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.

<script lang='typescript'>
import {onMount} from 'svelte';
let count: number = 0;
onMount(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const autoPreprocess = require('svelte-preprocess');

module.exports = {
preprocess: autoPreprocess({
defaults: {
script: 'typescript'
}
})
}
preprocess: autoPreprocess({
defaults: {
script: 'typescript',
},
}),
};