Repository navigation
Description
Corrected 2026-08-12. The original body attributed most of the TS2307 to the untyped
.jsmodules and did not list Cause 4. Neither is right: none of the TS2307 comes from.js. See the correction comment for the measurement.
This is split out from #721, which covers the same class of failure across jotai, redux, remix-router, and visx. recharts is filed separately because the volume is an order of magnitude larger and two of the three causes are specific to this package.
Summary
@octanejs/recharts publishes raw source ("files": ["src"], "exports": { ".": "./src/index.ts" }), so a consumer's TypeScript program compiles every reachable file in the package. Under the tsconfig our own CLI scaffolds, that produces 1507 errors. The package cannot be consumed by a strict TypeScript app.
Reproduction
Any app that imports @octanejs/recharts and runs tsrx-tsc --noEmit with the tsconfig from packages/cli/src/commands/init/templates.js. Within the monorepo, pointing that same tsconfig shape at packages/recharts/src reproduces it.
Error breakdown, consumer tsconfig:
| Code | Count | Meaning |
|---|---|---|
| TS7016 | 421 | no declaration file for an imported .js module |
| TS7006 | 367 | parameter implicitly any |
| TS2305 | 254 | module has no exported member |
| TS2307 | 148 | cannot find module |
| TS7031 | 86 | binding element implicitly any |
| TS2694 | 68 | namespace has no exported member |
Against the package's own tsconfig.json, still with tsrx-tsc, it is 1268 errors across 94 files. The current pnpm typecheck runs tsgo here instead, which ignores .tsrx entirely and exits 0.
Cause 1: 123 untyped .js modules are published
packages/recharts/src contains 123 .js files. None has a sibling .d.ts. The package's own tsconfig sets "allowJs": true, "checkJs": false, so they resolve locally. The scaffolded consumer tsconfig sets neither, so every import of one is an error. This accounts for the 421 TS7016.
It also produces errors that look unrelated. ./easing resolves to easing.js, so CSSTransitionAnimate.tsrx(11,10) reports that EasingInput and NamedBezier are not exported. The actual cause is that the module carries no types at all.
Cause 2: 16 published src/*.ts files are excluded from the package's own typecheck
packages/recharts/tsconfig.json excludes these, all of which exist and all of which ship in the tarball:
src/chart/types.ts
src/context/useTooltipAxis.ts
src/state/selectors/{area,funnel,pie,polarGrid,polarScale,polar,radar,radialBar,scatter}Selectors.ts
src/util/cursor/{getCursorPoints,getCursorRectangle,getRadialCursorPoints}.ts
src/util/scale/CartesianScaleHelper.ts
src/util/tooltip/translate.ts
exclude only filters the expansion of include. It does not remove files reached through the import graph, so consumers compile all 16 regardless. The package's own check is green because it skips 16 files that consumers cannot skip.
Cause 3: ./AnimationController does not exist
src/animation/CSSTransitionAnimate.tsrx:12
import type { AnimationController } from './AnimationController';
src/animation/ contains AnimationControllerImpl.js and no AnimationController. This one is independent of tsconfig and fails under any configuration.
Separately, CSSTransitionAnimate.tsrx(2,10) imports CSSProperties from octane, which does not export it.
Cause 4: 177 extensionless imports of .tsrx modules
147 TS2307 total
133 the specifier resolves to an existing sibling .tsrx
0 resolves to a .js
0 resolves to a .ts
14 genuinely does not exist
None of the TS2307 come from the .js modules. With allowJs off, importing a .js gives TS7016, not TS2307. The 133 are extensionless relative imports of .tsrx modules, for example import { Rectangle } from './shape/Rectangle' where only shape/Rectangle.tsrx exists. tsrx-tsc does not complete an extensionless specifier to .tsrx the way it does to .ts.
Counting extensionless relative imports whose only resolution is a sibling .tsrx, across every packages/*/src: recharts 177, every other package 0. Every other binding writes the extension.
The port leaned on this deliberately, and on something real. packages/octane/src/compiler/vite.js adds .tsrx to Vite's resolver extensions, commented as required so extensionless imports of octane components resolve exactly like React's .tsx. The bundler supports it on purpose; the typechecker does not. No consumer-side tsconfig bridges the gap: paths, allowArbitraryExtensions and a .tsrx.d.ts sidecar all still produce TS2307.
Suggested fix
- Fix the broken
./AnimationControllerimport and theCSSPropertiesimport. - Add the explicit
.tsrxextension at the 177 extensionless sites. 46 distinct target modules, none with a.ts,.tsxor.d.tssibling, so a codemod is unambiguous. Eight sites sit in vendored.tsfiles where the edit diverges from upstream and need the port owner's call. - Give the 123
.jsmodules real types, either by converting them to.tsor by shipping generated.d.tsalongside them. Converting is preferable, because a published.d.tscan drift from the.jsit describes. - Remove the 16
src/entries fromexcludeand fix what they surface. Consumers compile these files either way, so leaving them excluded here only hides the errors from us. - Drop
allowJs/checkJsfrom the package tsconfig once step 2 lands, so the package's config stops being more permissive than the consumer's. - Type the component props behind the 367 TS7006 and 86 TS7031. This is the one part shared with Several published TSRX source bindings fail strict consumer tsrx-tsc typechecking #721.
- Add
@octanejs/rechartstoPACKED_TSRX_CONSUMER_PACKAGESso this cannot regress, including the no-@types/nodevariant discussed in Several published TSRX source bindings fail strict consumer tsrx-tsc typechecking #721.
Steps 1 through 4 come before step 5 is worth doing: while the .js modules are untyped, a large share of the remaining diagnostics are downstream of missing types rather than genuine signal.
Activity
dudusotero commentedon Aug 12, 2026
Correcting a claim in the issue body before this gets closed by #733.
Cause 1 says the untyped
.jsmodules account for "the 421 TS7016 and most of the TS2307". The TS7016 half holds. The TS2307 half is wrong, and it points at the wrong fix.I resolved every TS2307 specifier against the filesystem:
So none of the TS2307 come from the
.jsmodules. WithallowJsoff, importing a.jsproduces TS7016, not TS2307. The 133 are extensionless relative imports of.tsrxmodules, for exampleimport { Rectangle } from './shape/Rectangle'where onlyshape/Rectangle.tsrxexists.tsrx-tscdoes not complete an extensionless specifier to.tsrxthe way it does to.ts.This is a fourth cause the issue did not list, and it is specific to this package. Counting extensionless relative imports whose only resolution is a sibling
.tsrx, across everypackages/*/srcin the repo:Every other binding writes the extension explicitly.
packages/recharts/docs-adjacent notes indocs/recharts-port-plan.mdrecord the choice to mirror upstream's layout "so upstream relative imports resolve unchanged", withBar.tsandLine.tsdescribed as extensionless-resolution shims, so the port leaned on this deliberately.It leaned on something real.
packages/octane/src/compiler/vite.jsadds.tsrxto Vite's resolver extension list, with a comment stating that extensionless imports of octane components must resolve exactly like React's.tsx, because faithful ports keep upstream's extensionless dynamic imports. So the bundler supports this on purpose and the typechecker does not. I could not find a consumer-side tsconfig that bridges it;paths,allowArbitraryExtensions, and a.tsrx.d.tssidecar on the target all still produce TS2307.Two consequences for the fix:
The mechanical part is 177 sites across 49 files, targeting 46 distinct modules. None of the 46 has a
.ts,.tsxor.d.tssibling, so.tsrxis the unambiguous completion at every site and a codemod is safe. Eight sites are in vendored.tsfiles where the extension edit would diverge from upstream, and those need the port owner's call.The toolchain asymmetry deserves its own issue regardless of what happens to recharts, or the next faithful port repeats this.
Separately: #730 routes
typesatsrc/index.d.ts, and #733 absorbs it. That stops consumers compiling the internal graph, so it resolves the consumer-facing symptom without touching any of the four causes. Worth noting thatpackages/rechartshas noscriptsentry of its own, whilepackages/visx/scripts/check-public-types.mjsexists precisely to stop a hand-written declaration surface drifting from the real one.test(packages): enforce strict TSRX source consumers (#733)