docs(weave): enable Twoslash on TypeScript code blocks#2757
Open
dbrian57 wants to merge 3 commits into
Open
Conversation
Adds the Mintlify `twoslash` flag to TS code fences across Weave guides, tutorials, concepts, and quickstarts so readers get IDE-style hover types on identifiers. Each block gets `// @noErrors` on the first line to suppress type errors from partial snippets (missing imports, etc.) until each snippet is made self-contained. Reference docs are intentionally excluded and will be handled in a separate PR. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
Contributor
📚 Mintlify Preview Links📝 Changed (33 total)📄 Pages (33)
🤖 Generated automatically when Mintlify deployment succeeds |
Contributor
🔗 Link Checker Results✅ All links are valid! No broken links were detected. Checked against: https://wb-21fd5541-weave-docs-twoslash.mintlify.app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Enables Mintlify's Twoslash on TypeScript code blocks across the Weave guides, tutorials, concepts, and quickstarts, so readers can hover identifiers for IDE-style type information.
What changed in each TS code block:
twoslashflag immediately after the language identifier, preserving any existinglines, line-range highlights, filename tokens, andtitle="..."metadata. Examples:```ts→```ts twoslash```typescript lines {1-2,7-8}→```typescript twoslash lines {1-2,7-8}```typescript route.ts lines {10}→```typescript twoslash route.ts lines {10}// @noErrorsas the first line inside every block to suppress type-checker errors from snippets that aren't fully self-contained (missing imports, partial setup, etc.). Twoslash treats this as a directive and strips it from the rendered output.Scope: 96 TS code blocks across 34 files in
weave/(excludingweave/reference/). Reference docs will be done in a follow-up PR.Why
// @noErrors?Most existing snippets reference symbols (
weave,OpenAI, third-party libs) without showing the imports/setup. Without// @noErrors, Twoslash would render "Cannot find module" errors inline on the published site. The directive can be removed per-block over time as snippets become self-contained, which is a good incentive to tighten them up.Testing
mint dev)weave/quickstart.mdx,weave/guides/integrations/openai.mdx) and confirm hover types render and no error squiggles leak throughweave/tutorial-eval.mdxhas several)Notes for reviewers
twoslashcombined withlines/title=/ filename tokens, so the canonical position is undocumented. I placedtwoslashimmediately after the language tag and before any other metadata. If a particular block renders oddly, that ordering is the first thing to revisit.weave/reference/) are deliberately untouched.🤖 Generated with Claude Code