-
-
Notifications
You must be signed in to change notification settings - Fork 161
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -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')) { |
There was a problem hiding this comment.
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/') |
There was a problem hiding this comment.
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')) { |
There was a problem hiding this comment.
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
fixes #999
This PR makes the following changes to fix types in the docs:
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
feat:
,fix:
,chore:
, ordocs:
.