Skip to content

fix(visx): type published source for consumer tsrx-tsc - #808

Merged
trueadm merged 5 commits into
mainfrom
cursor/visx-consumer-types-2a2e
Aug 21, 2026
Merged

trueadm merged 5 commits into
mainfrom
cursor/visx-consumer-types-2a2e

Conversation

@jonkwheeler

@jonkwheeler jonkwheeler commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Continue #721 for @octanejs/visx after #755. A consumer-shaped tsrx-tsc --noEmit -p packages/visx/tsconfig.json on current main still reported 90 diagnostics. This PR fixes the genuine visx typing problems (React attribute bags, synthetic events, FC/ReactElement leftovers) so the same check is 3 leftover diagnostics, all from the #737 compiler let __spread_props + host ref case.

Closes no issues. #721 stays open until recharts (#726) and the remaining #737 visx sites are gone.

Why

#755 moved 42 visx modules to Octane.SVGProps and cut in-src diagnostics from 158 to 90. The leftover 90 were concentrated in xychart series, tooltip/floating, brush, zoom, legend, and event types. Those are consumer-visible when compiling published .tsrx source; they are not framework defects and should not stay behind tsgo / SOURCE_PUBLICATION_DEBT.

Changes

  • XYChart / brush / annotation event handlers use native PointerEvent / MouseEvent / MouseTouchOrPointerEvent instead of React synthetics.
  • Series, axis, grid, annotation, tooltip, and legend render props use ComponentBody / ElementDescriptor / OctaneNode instead of FC / ReactElement.
  • Legend, tooltip, floating tooltip, text, theme, and sankey attribute bags use Octane.SVGProps / Octane.HTMLAttributes (or @octanejs/floating-ui bags). FloatingTooltipArrowProps omits FloatingArrow's index signature so height/width stay numeric.
  • className on Line / Bar / BarRounded / LinePath / BaseArea accepts Octane ClassValue.
  • Zoom pinch/listeners and useMeasure ResizeObserver types use DOM types. ResizeObserver remains a public Responsive type alias of the DOM class.
  • SvgPathComponent and PinchDeltaState stay internal so the published export name set is unchanged.
  • Axis default children renderer stays on createElement (JSX escaped tick markup during SSR).
  • withTooltip sidecar return is (props) => OctaneNode, not unknown.
  • Text and useText parity checks normalize the Octane/React attribute bags, and the class-wrapped TooltipWithBounds gets the same precise props comparison. Its generated sidecar now keeps (props) => ElementDescriptor instead of any.
  • Runtime behavior and export names are unchanged. Text / Tooltip / Projection JSX was not rewritten.

Measured tsrx-tsc counts

pnpm exec tsrx-tsc --noEmit --pretty false -p packages/visx/tsconfig.json
revision diagnostics notes
main (before) 90 matches #755 leftover count
this PR (after) 3 only #737 source leftovers

Remaining (intentional, not papered over):

  • packages/visx/src/geo/projections/Projection.tsrx:187 TS2345 (unknown vs MergeableRef)
  • packages/visx/src/text/Text.tsrx:37 TS2345 (unknown vs MergeableRef)
  • packages/visx/src/tooltip/tooltips/Tooltip.tsrx:72 TS2339 (ref missing on SpreadProps)

Remaining #721 work

Validation

  • pnpm format:check (passed after merging current main)
  • pnpm typecheck (passed after merging current main)
  • pnpm sync (passed; generated files current)
  • pnpm test (not run repo-wide)
  • targeted: pnpm exec tsrx-tsc --noEmit --pretty false -p packages/visx/tsconfig.json (90 → 3 expected Virtual TSX drops the let __spread_props declaration for a host element with ref plus a spread outside a direct return, producing TS2304 #737 source diagnostics)
  • targeted: pnpm --filter @octanejs/visx types:check (passed; public export names match)
  • targeted: pnpm --filter @octanejs/visx compile:check (passed)
  • targeted tests: pnpm exec vitest run --project visx --project visx-ssr (33 passed)
  • targeted tests: pnpm exec vitest run --project visx-differential (7 passed)

pnpm typecheck:files packages/visx still reports the 3 #737 source leftovers plus fixture files outside tsconfig.json include (tests/_fixtures, tests/conformance). Those fixtures are not the published-source consumer check.

Risk / follow-ups

  • Public visx types now use Octane bags and native events. Export names are the same; consumers that imported React SVGProps / synthetic event types through visx may see type differences.
  • Leave SOURCE_PUBLICATION_DEBT / tsgo promotion until visx is actually clean.

Provenance

  • An agent produced this draft (agent-authored)
Open in Web Open in Cursor 

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Replace leftover React SVG/HTML bags and synthetic events with Octane
attribute types and native DOM events so a consumer-shaped tsrx-tsc
check drops from 90 diagnostics to the #737 spread+ref leftovers.

Co-authored-by: Jon Wheeler <[email protected]>
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Aug 20, 2026

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: withTooltip sidecar erases return type
    • Annotated withTooltip to return (props: BaseComponentProps) => ElementDescriptor so the generated sidecar no longer collapses the wrapped component to unknown.

Create PR

Or push these changes by commenting:

@cursor push 0aaa9a57cf
Preview (0aaa9a57cf)
diff --git a/packages/visx/src/tooltip/enhancers/withTooltip.tsrx b/packages/visx/src/tooltip/enhancers/withTooltip.tsrx
--- a/packages/visx/src/tooltip/enhancers/withTooltip.tsrx
+++ b/packages/visx/src/tooltip/enhancers/withTooltip.tsrx
@@ -1,4 +1,4 @@
-import type { ComponentBody, ElementDescriptor, OctaneNode } from 'octane';
+import type { ComponentBody, ElementDescriptor } from 'octane';
 import type { Octane } from 'octane/jsx-runtime';
 
 import type { UseTooltipParams } from '../hooks/useTooltip.tsrx';
@@ -9,7 +9,7 @@
 type RenderTooltipContainer = (
 	children: ElementDescriptor,
 	containerProps?: WithTooltipContainerProps,
-) => ElementDescriptor | OctaneNode;
+) => ElementDescriptor;
 
 export default function withTooltip<BaseComponentProps = {}, TooltipData = {}>(
 	BaseComponent: ComponentBody<BaseComponentProps & WithTooltipProvidedProps<TooltipData>>,
@@ -23,7 +23,7 @@
 	renderContainer: RenderTooltipContainer = function defaultRenderContainer(children, props) {
 		return <div {...props}>{children}</div>;
 	},
-) {
+): (props: BaseComponentProps) => ElementDescriptor {
 	function WrappedComponent(props: BaseComponentProps) {
 		const tooltipProps = useTooltip<TooltipData>();
 

diff --git a/packages/visx/src/tooltip/enhancers/withTooltip.tsrx.d.ts b/packages/visx/src/tooltip/enhancers/withTooltip.tsrx.d.ts
--- a/packages/visx/src/tooltip/enhancers/withTooltip.tsrx.d.ts
+++ b/packages/visx/src/tooltip/enhancers/withTooltip.tsrx.d.ts
@@ -1,9 +1,9 @@
 // Generated by scripts/generate-tsrx-types.mjs.
-import type { ComponentBody, ElementDescriptor, OctaneNode } from 'octane';
+import type { ComponentBody, ElementDescriptor } from 'octane';
 import type { Octane } from 'octane/jsx-runtime';
 import type { UseTooltipParams } from '../hooks/useTooltip.tsrx';
 export type WithTooltipProvidedProps<TooltipData> = UseTooltipParams<TooltipData>;
 type WithTooltipContainerProps = Octane.HTMLAttributes<HTMLDivElement>;
-type RenderTooltipContainer = (children: ElementDescriptor, containerProps?: WithTooltipContainerProps) => ElementDescriptor | OctaneNode;
-export default function withTooltip<BaseComponentProps = {}, TooltipData = {}>(BaseComponent: ComponentBody<BaseComponentProps & WithTooltipProvidedProps<TooltipData>>, containerProps?: WithTooltipContainerProps, renderContainer?: RenderTooltipContainer): (props: BaseComponentProps) => unknown;
+type RenderTooltipContainer = (children: ElementDescriptor, containerProps?: WithTooltipContainerProps) => ElementDescriptor;
+export default function withTooltip<BaseComponentProps = {}, TooltipData = {}>(BaseComponent: ComponentBody<BaseComponentProps & WithTooltipProvidedProps<TooltipData>>, containerProps?: WithTooltipContainerProps, renderContainer?: RenderTooltipContainer): (props: BaseComponentProps) => ElementDescriptor;
 export {};

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit 6854c29. Configure here.

Re-export ResizeObserver as the DOM type, hide SvgPathComponent from the
XYChart barrel, and keep PinchDeltaState internal so types:check matches
the existing Visx surface.

Co-authored-by: Jon Wheeler <[email protected]>
@vercel

vercel Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
octane-website-mcp Skipped Skipped Aug 20, 2026 3:15pm

Request Review

@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 20, 2026 15:10 Inactive
JSX for the default Axis children renderer escaped tick markup during
SSR. Restore createElement and keep the generic children type with a
props assertion.

Co-authored-by: Jon Wheeler <[email protected]>
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 20, 2026 15:11 Inactive
The generated enhancer sidecar inferred (props) => unknown after the
React-to-Octane bag change. Annotate the wrapped component so consumers
keep a usable JSX return type.

Co-authored-by: Jon Wheeler <[email protected]>
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 20, 2026 15:15 Inactive
@trueadm
trueadm marked this pull request as ready for review August 21, 2026 12:48
@trueadm
trueadm merged commit 3004ba5 into main Aug 21, 2026
29 checks passed
@trueadm
trueadm deleted the cursor/visx-consumer-types-2a2e branch August 21, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants