Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: enable types in JS code blocks#1398

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
eltigerchino wants to merge3 commits intomain
base:main
Choose a base branch
Loading
fromfix-types
Draft

Conversation

eltigerchino
Copy link
Member

@eltigerchinoeltigerchino commentedJun 27, 2025
edited
Loading

fixes#999

This PR makes the following changes to fix types in the docs:

  • correctly generate types for JS code blocks by properly appending injected content, separating them with filenames.
  • makes additional types available on hover by installing the packages so that TypeScript can resolve their type info
  • cleans up some of the injected content that's duplicated or unused

This PR shouldn't be merged until all the required docs have their TypeScript error markers updated.

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 withfeat:,fix:,chore:, ordocs:.
  • This message body should clearly illustrate what problems it solves.

@vercelVercel
Copy link

vercelbot commentedJun 27, 2025
edited
Loading

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

NameStatusPreviewUpdated (UTC)
svelte-dev❌ Failed (Inspect)Jun 27, 2025 4:43pm

@@ -7,11 +7,7 @@ export const render_content = (
) => {
return render_content_markdown(filename, body, options, (filename, source) => {
// TODO these are copied from Svelte and SvelteKit - adjust for new filenames
const injected = [];

if (/(svelte)/.test(source) || filename.includes('typescript')) {
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This was previously always being injected for any file that mentions 'svelte'. Instead, we can just reference the Svelte types in the Twoslash typescript options

if (
source.includes('$app/') ||
source.includes('$service-worker') ||
source.includes('@sveltejs/kit/')
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

We don't need to check for@sveltejs/kit/* because Twoslash can resolve those itself

@@ -71,10 +69,6 @@ export const render_content = (
injected.push('// @errors: 7006 7031');
}

if (filename.endsWith('10-configuration.md')) {
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

There is no such file in the docs

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Types do not appear on hover for JSDoc annotated items
1 participant
@eltigerchino

[8]ページ先頭

©2009-2025 Movatter.jp