Skip to content

fix: add typescript as valid lang tag#5105

Closed
dummdidumm wants to merge 1 commit into
vitejs:mainfrom
dummdidumm:patch-1
Closed

fix: add typescript as valid lang tag#5105
dummdidumm wants to merge 1 commit into
vitejs:mainfrom
dummdidumm:patch-1

Conversation

@dummdidumm
Copy link
Copy Markdown
Contributor

@dummdidumm dummdidumm commented Sep 27, 2021

Description

Treat lang="typescript" the same as lang="ts" as the former is valid for Svelte to signal that the script tag contains TS

Additional context

If benefitial for the greater ecosystem, I'm okay with this PR getting rejected as "won't do" and instead persuade people into doing lang="ts" . Right now everyone who transitions to Vite will need to adhere to it, so we could use that as a way to force people to only write lang="ts" from now on.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

lang="typescript" is valid for Svelte
@dummdidumm dummdidumm changed the title (fix) add typescript as valid lang tag fix: add typescript as valid lang tag Sep 27, 2021
@bluwy
Copy link
Copy Markdown
Member

bluwy commented Sep 27, 2021

Extra context: Svelte (or svelte-preprocess specifically) had always supported lang="typescript", and the usage was 50/50 depending on user preference (Svelte didn't enforce one), so the switch to Vite/SvelteKit had tripped many users in the past. This caveat was also mentioned in vite-plugin-svelte's FAQ.

Although svelte-preprocess also supports type="text/typescript", those are really rare. I don't think Vite needs to support that.

@dummdidumm dummdidumm marked this pull request as draft September 27, 2021 11:57
@dummdidumm
Copy link
Copy Markdown
Contributor Author

Marked as draft so we can discuss first if this is really beneficial in the long run to have to variants to write this. @dominikg rightfully pointed out that it may be better to force people into one style of signaling that TS is used in the script block.

@dummdidumm
Copy link
Copy Markdown
Contributor Author

Closing as we came to agreement it would be better to not add extra stuff and instead standardize around lang="ts"

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