Skip to content

docs: Add twoslash-svelte#955

Closed
Hugos68 wants to merge 5 commits into
sveltejs:mainfrom
Hugos68:feat/twoslash-svelte
Closed

docs: Add twoslash-svelte#955
Hugos68 wants to merge 5 commits into
sveltejs:mainfrom
Hugos68:feat/twoslash-svelte

Conversation

@Hugos68

@Hugos68 Hugos68 commented Dec 7, 2024

Copy link
Copy Markdown

Closes #649

This PR replaced the twoslash with twoslash-svelte package to allow type hints to be available on svelte codeblocks.

Note:
Currently this PR installs the @hugokorte/twoslash-svelte PR, this is because the original/official twoslash-svelte package won't be published until This PR is merged. The code is simply a copy and published seperately.

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

  • It's really useful if your PR references an issue where it is discussed ahead of time.
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.

@vercel

vercel Bot commented Dec 7, 2024

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
svelte-dev ❌ Failed (Inspect) Jan 13, 2025 8:23am

@vercel

vercel Bot commented Dec 7, 2024

Copy link
Copy Markdown

@Hugos68 is attempting to deploy a commit to the Svelte Team on Vercel.

A member of the Team first needs to authorize it.

@Rich-Harris

Copy link
Copy Markdown
Member

Thank you! It looks like line 689 needs updating...

-} else if (language === 'js' || language === 'ts') {
+} else if (language === 'js' || language === 'ts' || language === 'svelte') {

...along with line 700:

-lang: 'ts',
+lang: language === 'svelte' ? language : 'ts',

Though when I make those changes locally, I start seeing errors like this which I I don't really understand 😆 maybe @dummdidumm can make sense of them:

index.tsx
[2304] 128 - Cannot find name 'svelteHTML'.
[2304] 323 - Cannot find name '__sveltets_2_isomorphic_component'.
[2304] 357 - Cannot find name '__sveltets_2_partial'.
[2304] 378 - Cannot find name '__sveltets_2_with_any_event'.

@Hugos68

Hugos68 commented Dec 13, 2024

Copy link
Copy Markdown
Author

Though when I make those changes locally, I start seeing errors like this

Ahh, these are expected! That means something is working, thanks for checking it out, I'll make your changes and continue working on it. I do have to see the Svelte docs rendered is quite the module. Lots of stuff going on.

@Hugos68

Hugos68 commented Jun 6, 2026

Copy link
Copy Markdown
Author

Since twoslash-svelte is now published I will aim to revisit this PR asap! I might just close it and recreate due to it being highely outdated.

@Hugos68

Hugos68 commented Jun 6, 2026

Copy link
Copy Markdown
Author

Closing this in favor of #2028

@Hugos68 Hugos68 closed this Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use shiki-twoslash for .svelte code blocks

3 participants