Repository navigation
fix(recharts): restore the AnimationController type module - #735
Merged
Merged
Conversation
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.
dudusotero
marked this pull request as ready for review
August 12, 2026 18:11
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
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 hasAnimationControllerImpl.jsand noAnimationController. Upstream[email protected]shipsanimation/AnimationController.tsas a types-only module, so its compiled JavaScript is literallyexport {}and the vendoring pass, which copies compiledes6output, had nothing to copy. The module is restored here, withAnimationHandlereconstructed from the realJavascriptAnimationandCSSTransitionAnimationclasses.TimeoutController,CancelableTimeoutandCallbackTypelive upstream intimeoutController.ts, which is vendored here as.jswith 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
CSSPropertiesfromoctane, which does not export it.import type { CSSProperties } from 'react'is the convention inpackages/popperandpackages/day-picker, but it fails here with TS7016 because this package has noreactor@types/reactdependency. The type is derived from Octane's own JSX surface instead, so nothing is added to the dependency graph andoctaneneeds no change.Package diagnostics under
tsrx-tscgo from 1268 to 1266.The three remaining diagnostics in this file are separate work. Two are
./easingreporting no exportedEasingInputorNamedBezier; under a consumer config that surfaces as TS7016, becauseeasing.jsis vendored without types. That belongs to the untyped-.jswork in #726 rather than here.Independent of #730 and #733, which route
typesatsrc/index.d.tsand do not touchsrc/animation.Refs #726.
Validation
pnpm format:checkpnpm typecheckpnpm testpnpm vitest run --project recharts(4 files, 29 tests, all passing)pnpm exec tsrx-tsc --noEmit -p packages/recharts/tsconfig.jsonbefore and after, showing 1268 to 1266 and both target diagnostics gone with no new diagnostic anywhere in the packagepnpm changeset:checkpnpm testwas 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 inpackages/recharts.Risk / follow-ups
Typing
useAnimationControllerwith the restored type removes bothTS2349diagnostics in this file, but converts one into a newTS2345inJavascriptAnimate.tsrx, whereStateSetter<number>is not assignable toOnAnimationStateUpdate. 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
timeoutControllertypes are duplicated rather than imported, as described above. TypingtimeoutController.jsis the follow-up that removes the duplication.Provenance
agent-authored)Note
Low Risk
Type-only additions and import fixes; no runtime animation behavior changes.
Overview
Fixes broken TypeScript imports in
CSSTransitionAnimateby restoring upstream’s types-onlyAnimationControllermodule and redefining the render-prop style type without pulling in React.Adds
AnimationController.tswithAnimationController,TimeoutController,AnimationHandle, and related types. Upstream’s compiledAnimationController.jsis empty, so vendoring never copied it even thoughCSSTransitionAnimatealready imported from./AnimationController.AnimationHandleis modeled asJavascriptAnimation | CSSTransitionAnimationfrom the vendored runtime classes; timeout-related types are temporarily co-located here until typed.jswrappers exist fortimeoutControllerandAnimationHandle.In
CSSTransitionAnimate.tsrx, drops the invalidCSSPropertiesimport fromoctaneand defines it fromOctane.HTMLAttributes<Element>['style']viaoctane/jsx-runtime, avoiding a new@types/reactdependency.Reviewed by Cursor Bugbot for commit 3d8907b. Bugbot is set up for automated code reviews on this repo. Configure here.