Merge pull request #19917 from pettyalex/master

Fix types for Recharts, optional properties were incorrectly marked required
This commit is contained in:
Benjamin Lichtman
2017-09-21 16:00:10 -07:00
committed by GitHub
2 changed files with 13 additions and 10 deletions

View File

@@ -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;

View File

@@ -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>
);
};