Repository navigation
fix(visx): type published source for consumer tsrx-tsc - #808
Merged
Merged
Conversation
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]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
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.
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]>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
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]>
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]>
trueadm
marked this pull request as ready for review
August 21, 2026 12:48
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.


Summary
Continue #721 for
@octanejs/visxafter #755. A consumer-shapedtsrx-tsc --noEmit -p packages/visx/tsconfig.jsonon currentmainstill reported 90 diagnostics. This PR fixes the genuine visx typing problems (React attribute bags, synthetic events,FC/ReactElementleftovers) so the same check is 3 leftover diagnostics, all from the #737 compilerlet __spread_props+ hostrefcase.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.SVGPropsand 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.tsrxsource; they are not framework defects and should not stay behindtsgo/SOURCE_PUBLICATION_DEBT.Changes
PointerEvent/MouseEvent/MouseTouchOrPointerEventinstead of React synthetics.ComponentBody/ElementDescriptor/OctaneNodeinstead ofFC/ReactElement.Octane.SVGProps/Octane.HTMLAttributes(or@octanejs/floating-uibags).FloatingTooltipArrowPropsomits FloatingArrow's index signature soheight/widthstay numeric.classNameon Line / Bar / BarRounded / LinePath / BaseArea accepts OctaneClassValue.useMeasureResizeObserver types use DOM types.ResizeObserverremains a public Responsive type alias of the DOM class.SvgPathComponentandPinchDeltaStatestay internal so the published export name set is unchanged.createElement(JSX escaped tick markup during SSR).withTooltipsidecar return is(props) => OctaneNode, notunknown.useTextparity checks normalize the Octane/React attribute bags, and the class-wrappedTooltipWithBoundsgets the same precise props comparison. Its generated sidecar now keeps(props) => ElementDescriptorinstead ofany.Measured
tsrx-tsccountsmain(before)Remaining (intentional, not papered over):
packages/visx/src/geo/projections/Projection.tsrx:187TS2345 (unknownvsMergeableRef)packages/visx/src/text/Text.tsrx:37TS2345 (unknownvsMergeableRef)packages/visx/src/tooltip/tooltips/Tooltip.tsrx:72TS2339 (refmissing onSpreadProps)Remaining #721 work
let __spread_propsdeclaration for a host element withrefplus a spread outside a directreturn, producing TS2304 #737 leftoverlet __spread_props+ hostrefin Text / Tooltip / Projection. Do not rewrite those JSX sites inside visx.packages/visx/tsconfig.jsonstays ontsgoviaSOURCE_PUBLICATION_DEBTuntil the 3 leftovers are gone. Not promoted here.Validation
pnpm format:check(passed after merging currentmain)pnpm typecheck(passed after merging currentmain)pnpm sync(passed; generated files current)pnpm test(not run repo-wide)pnpm exec tsrx-tsc --noEmit --pretty false -p packages/visx/tsconfig.json(90 → 3 expected Virtual TSX drops thelet __spread_propsdeclaration for a host element withrefplus a spread outside a directreturn, producing TS2304 #737 source diagnostics)pnpm --filter @octanejs/visx types:check(passed; public export names match)pnpm --filter @octanejs/visx compile:check(passed)pnpm exec vitest run --project visx --project visx-ssr(33 passed)pnpm exec vitest run --project visx-differential(7 passed)pnpm typecheck:files packages/visxstill reports the 3 #737 source leftovers plus fixture files outsidetsconfig.jsoninclude(tests/_fixtures,tests/conformance). Those fixtures are not the published-source consumer check.Risk / follow-ups
SVGProps/ synthetic event types through visx may see type differences.SOURCE_PUBLICATION_DEBT/ tsgo promotion until visx is actually clean.Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.