Skip to content

docs(weave): enable Twoslash on TypeScript code blocks#2757

Open
dbrian57 wants to merge 3 commits into
mainfrom
weave-docs-twoslash
Open

docs(weave): enable Twoslash on TypeScript code blocks#2757
dbrian57 wants to merge 3 commits into
mainfrom
weave-docs-twoslash

Conversation

@dbrian57

Copy link
Copy Markdown
Contributor

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:

  • Added the twoslash flag immediately after the language identifier, preserving any existing lines, line-range highlights, filename tokens, and title="..." 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}
  • Inserted // @noErrors as 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/ (excluding weave/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

  • Local build succeeds without errors (mint dev)
  • Spot-check a representative page (e.g. weave/quickstart.mdx, weave/guides/integrations/openai.mdx) and confirm hover types render and no error squiggles leak through
  • Verify metadata-rich fences still render line numbers / highlights / titles correctly (weave/tutorial-eval.mdx has several)

Notes for reviewers

  • Mintlify's docs don't show twoslash combined with lines / title= / filename tokens, so the canonical position is undocumented. I placed twoslash immediately after the language tag and before any other metadata. If a particular block renders oddly, that ordering is the first thing to revisit.
  • Reference docs (weave/reference/) are deliberately untouched.

🤖 Generated with Claude Code

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>
@dbrian57 dbrian57 requested a review from a team as a code owner June 12, 2026 14:35
@mintlify

mintlify Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
wandb 🟢 Ready View Preview Jun 12, 2026, 2:50 PM

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

📚 Mintlify Preview Links

🔗 View Full Preview

📝 Changed (33 total)

📄 Pages (33)

File Preview
weave/agents-quickstart.mdx Agents Quickstart
weave/guides/core-types/datasets.mdx Datasets
weave/guides/core-types/evaluations.mdx Evaluations
weave/guides/core-types/media.mdx Media
weave/guides/core-types/prompts.mdx Prompts
weave/guides/evaluation/evaluation_logger.mdx Evaluation Logger
weave/guides/evaluation/scorers.mdx Scorers
weave/guides/integrations/anthropic.mdx Anthropic
weave/guides/integrations/autopatching.mdx Autopatching
weave/guides/integrations/js.mdx Js
... and 23 more files

🤖 Generated automatically when Mintlify deployment succeeds
📍 Deployment: da2b4b4 at 2026-06-12 15:44:27 UTC

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

🔗 Link Checker Results

All links are valid!

No broken links were detected.

Checked against: https://wb-21fd5541-weave-docs-twoslash.mintlify.app

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.

1 participant