Imporve tree and tree-select type definitions

This commit is contained in:
Wei Zhu 2017-11-20 17:03:08 +08:00
parent cbaf54415e
commit 6837aedf69
3 changed files with 9 additions and 8 deletions

View File

@ -66,6 +66,10 @@ export interface OptGroupProps {
label?: React.ReactNode;
}
export interface SelectLocale {
notFoundContent?: string;
}
const SelectPropTypes = {
prefixCls: PropTypes.string,
className: PropTypes.string,

View File

@ -2,6 +2,7 @@ import * as React from 'react';
import RcTreeSelect, { TreeNode, SHOW_ALL, SHOW_PARENT, SHOW_CHILD } from 'rc-tree-select';
import classNames from 'classnames';
import { TreeSelectProps } from './interface';
import { SelectLocale } from '../select';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
import warning from '../_util/warning';
@ -23,7 +24,7 @@ export default class TreeSelect extends React.Component<TreeSelectProps, any> {
private rcTreeSelect: any;
constructor(props) {
constructor(props: TreeSelectProps) {
super(props);
warning(
@ -40,11 +41,11 @@ export default class TreeSelect extends React.Component<TreeSelectProps, any> {
this.rcTreeSelect.blur();
}
saveTreeSelect = (node) => {
saveTreeSelect = (node: typeof RcTreeSelect) => {
this.rcTreeSelect = node;
}
renderTreeSelect = (locale) => {
renderTreeSelect = (locale: SelectLocale) => {
const {
prefixCls,
className,

View File

@ -10,11 +10,7 @@ export interface AntTreeNodeProps {
isLeaf?: boolean;
}
export class AntTreeNode extends React.Component<AntTreeNodeProps, {}> {
render() {
return <AntTreeNode {...this.props} />;
}
}
export interface AntTreeNode extends React.Component<AntTreeNodeProps, {}> {}
export interface AntTreeNodeEvent {
event: 'check' | 'select';