mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-30 18:43:21 +08:00
Merge pull request #19917 from pettyalex/master
Fix types for Recharts, optional properties were incorrectly marked required
This commit is contained in:
18
types/recharts/index.d.ts
vendored
18
types/recharts/index.d.ts
vendored
@@ -146,7 +146,7 @@ export interface CartesianAxisProps {
|
||||
width?: number;
|
||||
height?: number;
|
||||
orientation?: 'top' | 'bottom' | 'left' | 'right';
|
||||
viewBox?: any;
|
||||
viewBox?: ViewBox;
|
||||
axisLine?: boolean | any;
|
||||
tickLine?: boolean | any;
|
||||
minTickGap?: number;
|
||||
@@ -537,9 +537,9 @@ export interface ReferenceAreaProps {
|
||||
y1?: number | string;
|
||||
y2?: number | string;
|
||||
alwaysShow?: boolean;
|
||||
viewBox: any;
|
||||
xAxis: any;
|
||||
yAxis: any;
|
||||
viewBox?: ViewBox;
|
||||
xAxis?: any;
|
||||
yAxis?: any;
|
||||
label?: string | number | React.ReactElement<any> | RechartsFunction;
|
||||
isFront?: boolean;
|
||||
}
|
||||
@@ -574,9 +574,9 @@ export interface ReferenceLineProps {
|
||||
x?: number | string;
|
||||
y?: number | string;
|
||||
alwaysShow?: boolean;
|
||||
viewBox: any;
|
||||
xAxis: any;
|
||||
yAxis: any;
|
||||
viewBox?: ViewBox;
|
||||
xAxis?: any;
|
||||
yAxis?: any;
|
||||
label?: string | number | React.ReactElement<any> | RechartsFunction;
|
||||
isFront?: boolean;
|
||||
}
|
||||
@@ -685,7 +685,7 @@ export interface TooltipProps {
|
||||
wrapperStyle?: any;
|
||||
labelStyle?: any;
|
||||
cursor?: boolean | any | React.ReactElement<any> | React.StatelessComponent<any>;
|
||||
viewBox: ViewBox;
|
||||
viewBox?: ViewBox;
|
||||
active?: boolean;
|
||||
coordinate?: Coordinate;
|
||||
payload?: TooltipPayload[];
|
||||
@@ -713,7 +713,7 @@ export interface TreemapProps {
|
||||
}
|
||||
|
||||
export interface Label {
|
||||
viewBox?: any;
|
||||
viewBox?: ViewBox;
|
||||
formatter?: RechartsFunction;
|
||||
value: string | number;
|
||||
position?: PositionType;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
|
||||
import { CartesianGrid, Line, LineChart, XAxis, YAxis } from 'recharts';
|
||||
import { CartesianGrid, Line, LineChart, XAxis, YAxis, Tooltip, ReferenceLine, ReferenceArea } from 'recharts';
|
||||
|
||||
const Component = (props: {}) => {
|
||||
const data = [
|
||||
@@ -21,6 +21,9 @@ const Component = (props: {}) => {
|
||||
<CartesianGrid stroke="#eee" strokeDasharray="5 5"/>
|
||||
<Line type="monotone" dataKey="uv" stroke="#8884d8" />
|
||||
<Line type="monotone" dataKey="pv" stroke="#82ca9d" />
|
||||
<Tooltip />
|
||||
<ReferenceLine />
|
||||
<ReferenceArea />
|
||||
</LineChart>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user