Skip to content

internal(website): Type csstype and number-flow in playgrounds - #4139

Merged
ntucker merged 4 commits into
claude/project-thread-ynhl0cfrom
claude/project-thread-jq3oha
Oct 4, 2026
Merged

ntucker merged 4 commits into
claude/project-thread-ynhl0cfrom
claude/project-thread-jq3oha

Conversation

@ntucker

@ntucker ntucker commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Nathaniel · project thread

Stacked on #4136 (base is its branch, which now includes #4137; retarget to master once #4104 and #4136 merge).

Motivation

Before: editor-types/react.d.ts imports csstype and @number-flow/react imports number-flow/lite and number-flow/plugins, none of which were mounted, so style values and NumberFlow's format/trend/plugins props were any.

After:

const style: React.CSSProperties = { display: 5 };
// was accepted, now "Type 'number' is not assignable to type 'Display | undefined'"
style.display; // was any, now CSS.Property.Display | undefined

<NumberFlow value={5} trend="sideways" />;
// was accepted, now "Type 'string' is not assignable to type 'Trend'"
import { continuous } from '@number-flow/react'; // was any, now Plugin

Solution

  • csstype: copywebsitetypes.sh reprints csstype/index.d.ts without comments (new scripts/strip-dts-comments.mjs). Its MDN JSDoc is ~75% of the file, so this cuts the chunk from 85KB to 31KB gzipped (react.d.ts is 33KB) at the cost of CSS property hover docs.
  • @number-flow/react: instead of a verbatim copy, rollup-plugin-dts now bundles it with its number-flow/lite and number-flow/plugins imports inlined (8KB, only imports react), so no extra modules are mounted.
  • uuid-types.rollup.config.js becomes editor-types.rollup.config.js, building both uuid and @number-flow/react with one shared resolver for ./x.js and extensionless ./x imports (uuid.d.ts output is unchanged).

Verification

  • Offline harness (Monaco 0.56 tsWorker + real fetchTypeLibs/addTypeLibs) over 119 playgrounds (281 files): no playground diagnostics changed, so no docs code had invalid style props. In the libs, the Cannot find module errors for csstype/number-flow/* are gone; the only new ones are TS1038 (declare inside declare module), which every lib already has and skipLibCheck hides.
  • Real browser (docs dev server): Monaco markers on 10 pages are identical before and after; a probe model shows the errors above and that unknown names still error.
  • yarn workspace rdc-website typecheck, lint and prettier clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SP4rqYKdew65uNyP8xeJ9m

claude added 2 commits October 4, 2026 02:26
…er.js in playgrounds

Mount real declarations for `react/jsx-runtime` (was an empty stub),
`path-to-regexp` (never mounted, so @data-client/rest's PathFunction and
ParamData were unresolved) and `bignumber.js` (stub whose types were never
mounted), and declare `BigNumber` as a playground global since the preview
scope provides it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W5R8xxJwz7dAy3Uk2v5eH5
React's CSSProperties and NumberFlow's props resolved through unmounted
modules, so style values and NumberFlow format/trend/plugins were any.
Mount csstype (comments stripped, 85KB -> 31KB gzipped) and a bundled
number-flow/lite; number-flow/plugins re-exports from it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SP4rqYKdew65uNyP8xeJ9m
@ntucker ntucker self-assigned this Oct 4, 2026
@changeset-bot

changeset-bot Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 84cb28a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel

vercel Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs-site Ready Ready Preview Oct 4, 2026 3:22am UTC

Request Review

@codecov

codecov Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.95%. Comparing base (2b1c92d) to head (84cb28a).

Additional details and impacted files
@@                      Coverage Diff                      @@
##           claude/project-thread-ynhl0c    #4139   +/-   ##
=============================================================
  Coverage                         97.95%   97.95%           
=============================================================
  Files                               158      158           
  Lines                              3088     3088           
  Branches                            615      615           
=============================================================
  Hits                               3025     3025           
  Misses                               18       18           
  Partials                             45       45           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Base automatically changed from claude/project-thread-lkvlr1 to claude/project-thread-ynhl0c October 4, 2026 03:18
claude added 2 commits October 4, 2026 03:21
Bundle @number-flow/react's .d.ts with its number-flow/lite and
number-flow/plugins imports inlined, instead of mounting those as
separate modules with a hand-written plugins stub. uuid and number-flow
now share one editor-types rollup config and resolver.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SP4rqYKdew65uNyP8xeJ9m
…to claude/project-thread-jq3oha

# Conflicts:
#	scripts/copywebsitetypes.sh
#	website/src/components/Playground/monaco/typeLibs.ts
@ntucker
ntucker merged commit d232836 into claude/project-thread-ynhl0c Oct 4, 2026
22 checks passed
@ntucker
ntucker deleted the claude/project-thread-jq3oha branch October 4, 2026 03:57
ntucker added a commit that referenced this pull request Oct 5, 2026
…cript (#4136)

* internal(website): Reorganize Playground into editor/monaco/preview

Split the 362-line monaco-init into focused modules (setup, typeLibs,
theme, navigation, modelPath), group preview execution under preview/,
and replace forwarding modules with direct imports. Behavior is
unchanged; the new README documents the SSR, incremental-loading,
mobile/bot and hidden-tab invariants a future change must keep.

- monaco/: setup side effect, table-driven type libs (same chunks and
  order), cross-tab navigation, `/<id>/<path>` model URI helpers
- editor/: InteractiveEditor (Monaco or mobile react-live) and
  StaticEditor (SSR/crawler/loading markup)
- userAgent.ts: one source for bot/mobile regexes (isGoogleBot → isBot)
- Remove PlaygroundEditor, PlaygroundLiveEditor, DiffEditorChooser
  aliases, the unused readOnly prop, and unreferenced resources/
- Unit tests for highlight selections and model paths

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015H36Yk4WBpytw9L7RRVCTK

* internal(website): Keep highlightSelections free of website-only deps

CI runs Playground unit tests without website dependencies installed,
so parse the highlight range in InteractiveEditor and pass line numbers.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015H36Yk4WBpytw9L7RRVCTK

* internal(website): Cover useModelId and empty highlight ranges

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015H36Yk4WBpytw9L7RRVCTK

* internal(website): Restore PlaygroundEditor, PlaygroundLiveEditor, DiffEditorChooser, readOnly and resources

Keep these entry points and the readOnly option available for future
use; they now point at the reorganized editor modules.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015H36Yk4WBpytw9L7RRVCTK

* internal(website): Restore deletions Staff already accepted

cf2de88 brought the dead files and the unused editor prop back.
This commit restores the deletions Staff already accepted.

Review: #4104 (review)

Co-authored-by: Nathaniel Tucker <me@ntucker.me>

* internal(website): Keep restored Playground files and readOnly prop

Reverts 82bf2d0 per Nathaniel's choice to keep PlaygroundEditor,
DiffEditorChooser, the readOnly prop and Playground/resources for now.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015H36Yk4WBpytw9L7RRVCTK

* internal(website): Correct useModelId comment and DiffEditor README chain

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015H36Yk4WBpytw9L7RRVCTK

* internal(website): Scope import completions per playground, accept bare path= metastrings

Import completions for relative paths now list only files from the same
playground instead of every Monaco model on the page. Fence metastrings
accept unquoted path=a.ts (used in docs/rest/api/RestEndpoint.md). Also
prettier-formats the Playground README.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015H36Yk4WBpytw9L7RRVCTK

* internal(website): Declare playground editor globals with valid TypeScript

`declare globals { … }` is not TypeScript; the playground globals only typed
because parser error recovery leaked the wrapped declarations into global
scope, and DateTimeFormat silently became `any`.

Mount editor-types/globals.d.ts as a module and alias its exports, React,
JSX, NumberFlow, Temporal, DateTimeFormat and Manager into `declare global`.
Also type TextInput/TextArea/Formatted props that referenced unresolved names.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TkVym3YjjuSjBKhLLwvZm6

* internal(website): Type use and mockFetch playground globals

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TkVym3YjjuSjBKhLLwvZm6

* internal(website): Type React jsx-runtime, path-to-regexp and bignumber.js in playgrounds (#4137)

Mount real declarations for `react/jsx-runtime` (was an empty stub),
`path-to-regexp` (never mounted, so @data-client/rest's PathFunction and
ParamData were unresolved) and `bignumber.js` (stub whose types were never
mounted), and declare `BigNumber` as a playground global since the preview
scope provides it.


Claude-Session: https://claude.ai/code/session_01W5R8xxJwz7dAy3Uk2v5eH5

Co-authored-by: Claude <noreply@anthropic.com>

* internal(website): Type csstype and number-flow in playgrounds (#4139)

* internal(website): Type React jsx-runtime, path-to-regexp and bignumber.js in playgrounds

Mount real declarations for `react/jsx-runtime` (was an empty stub),
`path-to-regexp` (never mounted, so @data-client/rest's PathFunction and
ParamData were unresolved) and `bignumber.js` (stub whose types were never
mounted), and declare `BigNumber` as a playground global since the preview
scope provides it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W5R8xxJwz7dAy3Uk2v5eH5

* internal(website): Type csstype and number-flow in playgrounds

React's CSSProperties and NumberFlow's props resolved through unmounted
modules, so style values and NumberFlow format/trend/plugins were any.
Mount csstype (comments stripped, 85KB -> 31KB gzipped) and a bundled
number-flow/lite; number-flow/plugins re-exports from it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SP4rqYKdew65uNyP8xeJ9m

* internal(website): Bundle @number-flow/react types with number-flow

Bundle @number-flow/react's .d.ts with its number-flow/lite and
number-flow/plugins imports inlined, instead of mounting those as
separate modules with a hand-written plugins stub. uuid and number-flow
now share one editor-types rollup config and resolver.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SP4rqYKdew65uNyP8xeJ9m

---------

Co-authored-by: Claude <noreply@anthropic.com>

* internal(website): Simplify Playground metastring, model path and type-lib helpers

- One metaValue() parser for title= and path= (quotes optional for both)
- One anchored model-id regex; stripModelId is a replace
- Mark preview-scope global libs in MODULE_LIBS instead of modules[0]
- language is required on InteractiveEditor (codeModel always sets it)
- Drop unused return from Monaco setup

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015H36Yk4WBpytw9L7RRVCTK

* internal(website): Simplify playground globals parsing

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TkVym3YjjuSjBKhLLwvZm6

* internal(website): Simplify playground editor-types build

Bundle globals.d.ts from the editor-types rollup config (one rollup run,
identical output), make mockFetch generic to match its editor declaration,
and trim the README note.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TkVym3YjjuSjBKhLLwvZm6

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
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.

2 participants