Skip to content

fix(recharts): restore the AnimationController type module - #735

Merged
trueadm merged 3 commits into
octanejs:mainfrom
dudusotero:fix/recharts-broken-imports
Aug 12, 2026
Merged

trueadm merged 3 commits into
octanejs:mainfrom
dudusotero:fix/recharts-broken-imports

Conversation

@dudusotero

@dudusotero dudusotero commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two broken imports in packages/recharts/src/animation/CSSTransitionAnimate.tsrx. Both fail under any tsconfig, so neither depends on how a consumer is configured.

import type { AnimationController } from './AnimationController' pointed at a module that does not exist. The directory has AnimationControllerImpl.js and no AnimationController. Upstream [email protected] ships animation/AnimationController.ts as a types-only module, so its compiled JavaScript is literally export {} and the vendoring pass, which copies compiled es6 output, had nothing to copy. The module is restored here, with AnimationHandle reconstructed from the real JavascriptAnimation and CSSTransitionAnimation classes.

TimeoutController, CancelableTimeout and CallbackType live upstream in timeoutController.ts, which is vendored here as .js with its type-only exports erased. They are co-located in the restored module with a comment saying to move them back once that module carries types. That co-location is the one judgement call in this change.

The same file imported CSSProperties from octane, which does not export it. import type { CSSProperties } from 'react' is the convention in packages/popper and packages/day-picker, but it fails here with TS7016 because this package has no react or @types/react dependency. The type is derived from Octane's own JSX surface instead, so nothing is added to the dependency graph and octane needs no change.

Package diagnostics under tsrx-tsc go from 1268 to 1266.

The three remaining diagnostics in this file are separate work. Two are ./easing reporting no exported EasingInput or NamedBezier; under a consumer config that surfaces as TS7016, because easing.js is vendored without types. That belongs to the untyped-.js work in #726 rather than here.

Independent of #730 and #733, which route types at src/index.d.ts and do not touch src/animation.

Refs #726.

Validation

  • pnpm format:check
  • pnpm typecheck
  • pnpm test
  • targeted tests:
    • pnpm vitest run --project recharts (4 files, 29 tests, all passing)
    • pnpm exec tsrx-tsc --noEmit -p packages/recharts/tsconfig.json before and after, showing 1268 to 1266 and both target diagnostics gone with no new diagnostic anywhere in the package
    • pnpm changeset:check

pnpm test was not run in full. It was run earlier over a superset of this change: 5 test files failed out of 2301, all pre-existing on this base, and none in packages/recharts.

Risk / follow-ups

Typing useAnimationController with the restored type removes both TS2349 diagnostics in this file, but converts one into a new TS2345 in JavascriptAnimate.tsrx, where StateSetter<number> is not assignable to OnAnimationStateUpdate. Net minus one, but it pushes a fresh error into a neighbouring file that needs its own typing pass, so it is deliberately not done here.

The timeoutController types are duplicated rather than imported, as described above. Typing timeoutController.js is the follow-up that removes the duplication.

Provenance

  • An agent produced this diff (agent-authored)

Note

Low Risk
Type-only additions and import fixes; no runtime animation behavior changes.

Overview
Fixes broken TypeScript imports in CSSTransitionAnimate by restoring upstream’s types-only AnimationController module and redefining the render-prop style type without pulling in React.

Adds AnimationController.ts with AnimationController, TimeoutController, AnimationHandle, and related types. Upstream’s compiled AnimationController.js is empty, so vendoring never copied it even though CSSTransitionAnimate already imported from ./AnimationController. AnimationHandle is modeled as JavascriptAnimation | CSSTransitionAnimation from the vendored runtime classes; timeout-related types are temporarily co-located here until typed .js wrappers exist for timeoutController and AnimationHandle.

In CSSTransitionAnimate.tsrx, drops the invalid CSSProperties import from octane and defines it from Octane.HTMLAttributes<Element>['style'] via octane/jsx-runtime, avoiding a new @types/react dependency.

Reviewed by Cursor Bugbot for commit 3d8907b. Bugbot is set up for automated code reviews on this repo. Configure here.

CSSTransitionAnimate imported `AnimationController` from './AnimationController',
which does not exist. Upstream ships that module as types-only, so its compiled
JavaScript is `export {}` and the vendoring pass, which copies compiled es6
output, dropped it. AnimationHandle is reconstructed from the real
JavascriptAnimation and CSSTransitionAnimation classes.

The same file imported `CSSProperties` from `octane`, which does not export it.
The style type now derives from octane's own JSX surface, so this needs no
`react` dependency the package does not have.

Package diagnostics under tsrx-tsc go from 1268 to 1266. The remaining
`./easing` errors in this file are downstream of easing.js being untyped and
are tracked separately.
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Aug 12, 2026
@dudusotero
dudusotero marked this pull request as ready for review August 12, 2026 18:11
@trueadm
trueadm merged commit 71e3382 into octanejs:main Aug 12, 2026
45 checks passed
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.

2 participants