What is the current behavior?
Receiving build errors such as:
src/lib/components/bar/bar.tsx(22,14): error TS4023: Exported variable 'Bar' has or is using name 'BarEvents' from external module "/home/runner/_work/pb-frontend/pb-frontend/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected][email protected]/node_modules/recharts/types/cartesian/Bar" but cannot be named.
src/lib/components/line/line.tsx(11,14): error TS4023: Exported variable 'Line' has or is using name 'CurveProps' from external module "/home/runner/_work/pb-frontend/pb-frontend/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected][email protected]/node_modules/recharts/types/shape/Curve" but cannot be named.
src/lib/components/line/line.tsx(11,14): error TS4023: Exported variable 'Line' has or is using name 'LineProps' from external module "/home/runner/_work/pb-frontend/pb-frontend/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected][email protected]/node_modules/recharts/types/cartesian/Line" but cannot be named.
It seems like types BarEvents, CurveProps should not be internal types. This started happening when my project was set to use project references by enabling composite: true,declaration: true and incremental: true.
One of the files looked like this:
import React, { forwardRef } from 'react';
import type { LineProps } from 'recharts';
import { Line as RechartsLine } from 'recharts';
const LINE_CHART_DEFAULT_PROPS = {
type: 'linear' as const,
strokeWidth: 2,
dot: false,
};
export const Line = forwardRef<HTMLElement, LineProps>((props, _ref) => (
<RechartsLine {...LINE_CHART_DEFAULT_PROPS} {...props} />
));
Line.displayName = 'Line';
Setting export interface LineProps in types/cartesian/Line.d.ts and export interface CurveProps in types/shape/Curve.d.ts helps the issue.
For the other file, changing import from:
import type { BarProps, LabelProps } from 'recharts';
to
import type { BarProps } from 'recharts/types/cartesian/Bar';
seems to do the trick.
What is the expected behavior?
Not get build errors
Please provide a demo of the problem in a sandbox
Clone this repo: https://github.com/productboardlabs/recharts-build-issue-bug
Run pnpm install and then pnpm build
Please try to keep the demo as small as possible while still showing the problem.
Which versions of Recharts, and which browser / OS are affected by this issue? Did this work in previous versions of Recharts?
[email protected] and [email protected]
What is the current behavior?
Receiving build errors such as:
It seems like types
BarEvents,CurvePropsshould not be internal types. This started happening when my project was set to use project references by enablingcomposite: true,declaration: trueandincremental: true.One of the files looked like this:
Setting
export interface LinePropsintypes/cartesian/Line.d.tsandexport interface CurvePropsintypes/shape/Curve.d.tshelps the issue.For the other file, changing import from:
import type { BarProps, LabelProps } from 'recharts';to
import type { BarProps } from 'recharts/types/cartesian/Bar';seems to do the trick.
What is the expected behavior?
Not get build errors
Please provide a demo of the problem in a sandbox
Clone this repo: https://github.com/productboardlabs/recharts-build-issue-bug
Run
pnpm installand thenpnpm buildPlease try to keep the demo as small as possible while still showing the problem.
Which versions of Recharts, and which browser / OS are affected by this issue? Did this work in previous versions of Recharts?
[email protected]and[email protected]