make core.d.ts inherit index.d.ts, fix inconsistence in d.ts fix #226 (#232)

* add core.d.ts for ReactEchartsCore for ts

* make echarts props nessary in core.d.ts

* make core.d.ts inherit index.d.ts
This commit is contained in:
xsthunder 2018-09-30 19:50:00 +08:00 committed by hustcc
parent 4b248e5281
commit 5763e01a4d
2 changed files with 5 additions and 34 deletions

36
lib/core.d.ts vendored
View File

@ -1,39 +1,11 @@
/// <reference types="react" />
import * as React from 'react';
import {ReactEchartsPropsTypes} from './index.d'
type Func = (...args: any[]) => any;
interface EventMap {
[key: string]: Func,
}
interface ObjectMap {
[key: string]: any,
}
interface optsMap {
devicePixelRatio?: number,
renderer?: 'canvas' | 'svg',
width?: number | null | undefined | 'auto',
height?: number | null | undefined | 'auto',
}
// Index
export interface ReactEchartsPropsTypes {
option: ObjectMap;
notMerge?: boolean;
lazyUpdate?: boolean;
style?: ObjectMap;
className?: string;
theme?: string | null | ObjectMap;
onChartReady?: Func;
showLoading?: boolean;
loadingOption?: ObjectMap;
onEvents?: EventMap;
// Core
export interface ReactEchartsCorePropsTypes extends ReactEchartsPropsTypes{
echarts: object;
opts?: optsMap;
shouldSetOption?: Func;
}
export default class ReactEchartsCore extends React.Component<ReactEchartsPropsTypes, any>{}
export default class ReactEchartsCore extends React.Component<ReactEchartsCorePropsTypes, any>{}

3
lib/index.d.ts vendored
View File

@ -26,12 +26,11 @@ export interface ReactEchartsPropsTypes {
lazyUpdate?: boolean;
style?: ObjectMap;
className?: string;
theme?: string | null;
theme?: string | null | ObjectMap;
onChartReady?: Func;
showLoading?: boolean;
loadingOption?: ObjectMap;
onEvents?: EventMap;
echarts?: object;
opts?: optsMap;
shouldSetOption?: Func;
}