mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-19 17:00:53 +08:00
【Please review】Fixes for supporting TypeScript 2.0.3 (#3439)
* Fixes for supporting TypeScript 2.0.3 * Fixes for supporting TypeScript 2.0.3. Issue is #3358
This commit is contained in:
parent
c082e1b1d1
commit
23dd825afd
2
components/alert/index.tsx
Normal file → Executable file
2
components/alert/index.tsx
Normal file → Executable file
@ -18,7 +18,7 @@ export interface AlertProps {
|
|||||||
/** Additional content of Alert */
|
/** Additional content of Alert */
|
||||||
description?: React.ReactNode;
|
description?: React.ReactNode;
|
||||||
/** Callback when close Alert */
|
/** Callback when close Alert */
|
||||||
onClose?: (event) => void;
|
onClose?: React.MouseEventHandler;
|
||||||
/** Whether to show icon */
|
/** Whether to show icon */
|
||||||
showIcon?: boolean;
|
showIcon?: boolean;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
|
9
components/auto-complete/index.tsx
Normal file → Executable file
9
components/auto-complete/index.tsx
Normal file → Executable file
@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Select, { Option, OptGroup } from '../select';
|
import Select, { OptionProps, OptGroupProps } from '../select';
|
||||||
|
import { Option, OptGroup } from 'rc-select';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
export interface SelectedValue {
|
export interface SelectedValue {
|
||||||
@ -23,13 +24,13 @@ export interface AutoCompleteProps {
|
|||||||
defaultValue?: string | Array<any> | SelectedValue | Array<SelectedValue>;
|
defaultValue?: string | Array<any> | SelectedValue | Array<SelectedValue>;
|
||||||
value?: string | Array<any> | SelectedValue | Array<SelectedValue>;
|
value?: string | Array<any> | SelectedValue | Array<SelectedValue>;
|
||||||
allowClear?: boolean;
|
allowClear?: boolean;
|
||||||
onChange?: (value) => void;
|
onChange?: (value: string | Array<any> | SelectedValue | Array<SelectedValue>) => void;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class AutoComplete extends React.Component<AutoCompleteProps, any> {
|
export default class AutoComplete extends React.Component<AutoCompleteProps, any> {
|
||||||
static Option = Option;
|
static Option = Option as React.ClassicComponentClass<OptionProps>;
|
||||||
static OptGroup = OptGroup;
|
static OptGroup = OptGroup as React.ClassicComponentClass<OptGroupProps>;
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
prefixCls: 'ant-select',
|
prefixCls: 'ant-select',
|
||||||
|
2
components/back-top/index.tsx
Normal file → Executable file
2
components/back-top/index.tsx
Normal file → Executable file
@ -25,7 +25,7 @@ const easeInOutCubic = (t, b, c, d) => {
|
|||||||
|
|
||||||
export interface BackTopProps {
|
export interface BackTopProps {
|
||||||
visibilityHeight?: number;
|
visibilityHeight?: number;
|
||||||
onClick?: (event) => void;
|
onClick?: React.MouseEventHandler;
|
||||||
target?: () => HTMLElement | Window;
|
target?: () => HTMLElement | Window;
|
||||||
prefixCls?: string;
|
prefixCls?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
|
2
components/breadcrumb/Breadcrumb.tsx
Normal file → Executable file
2
components/breadcrumb/Breadcrumb.tsx
Normal file → Executable file
@ -8,7 +8,7 @@ export interface BreadcrumbProps {
|
|||||||
routes?: Array<any>;
|
routes?: Array<any>;
|
||||||
params?: Object;
|
params?: Object;
|
||||||
separator?: string | React.ReactNode;
|
separator?: string | React.ReactNode;
|
||||||
itemRender?: (route, params, routes, paths) => React.ReactNode;
|
itemRender?: (route: any, params: any, routes: Array<any>, paths: Array<string>) => React.ReactNode;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
2
components/date-picker/index.tsx
Normal file → Executable file
2
components/date-picker/index.tsx
Normal file → Executable file
@ -16,7 +16,7 @@ export interface PickerProps {
|
|||||||
popupStyle?: React.CSSProperties;
|
popupStyle?: React.CSSProperties;
|
||||||
locale?: any;
|
locale?: any;
|
||||||
size?: 'large' | 'small' | 'default';
|
size?: 'large' | 'small' | 'default';
|
||||||
getCalendarContainer?: (trigger) => React.ReactNode;
|
getCalendarContainer?: (trigger: any) => React.ReactNode;
|
||||||
prefixCls?: string;
|
prefixCls?: string;
|
||||||
inputPrefixCls?: string;
|
inputPrefixCls?: string;
|
||||||
}
|
}
|
||||||
|
2
components/form/Form.tsx
Normal file → Executable file
2
components/form/Form.tsx
Normal file → Executable file
@ -62,7 +62,7 @@ export type WrappedFormUtils = {
|
|||||||
/** 收集子节点的值的时机 */
|
/** 收集子节点的值的时机 */
|
||||||
trigger?: string;
|
trigger?: string;
|
||||||
/** 可以把 onChange 的参数转化为控件的值,例如 DatePicker 可设为:(date, dateString) => dateString */
|
/** 可以把 onChange 的参数转化为控件的值,例如 DatePicker 可设为:(date, dateString) => dateString */
|
||||||
getValueFromEvent?: (...args) => any;
|
getValueFromEvent?: (...args: any[]) => any;
|
||||||
/** 校验子节点值的时机 */
|
/** 校验子节点值的时机 */
|
||||||
validateTrigger?: string;
|
validateTrigger?: string;
|
||||||
/** 校验规则,参见 [async-validator](https://github.com/yiminghe/async-validator) */
|
/** 校验规则,参见 [async-validator](https://github.com/yiminghe/async-validator) */
|
||||||
|
2
components/icon/index.tsx
Normal file → Executable file
2
components/icon/index.tsx
Normal file → Executable file
@ -6,7 +6,7 @@ export interface IconProps {
|
|||||||
type: string;
|
type: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
onClick?: (e) => void;
|
onClick?: React.MouseEventHandler;
|
||||||
spin?: boolean;
|
spin?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
components/message/index.tsx
Normal file → Executable file
4
components/message/index.tsx
Normal file → Executable file
@ -55,7 +55,7 @@ function notice(
|
|||||||
|
|
||||||
type ConfigContent = React.ReactNode | string;
|
type ConfigContent = React.ReactNode | string;
|
||||||
type ConfigDuration = number;
|
type ConfigDuration = number;
|
||||||
type ConfigOnClose = () => void;
|
export type ConfigOnClose = () => void;
|
||||||
|
|
||||||
export interface ConfigOptions {
|
export interface ConfigOptions {
|
||||||
top?: number;
|
top?: number;
|
||||||
@ -64,7 +64,7 @@ export interface ConfigOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
info(content: ConfigContent, duration?: ConfigDuration, onClose?: ConfigOnClose) {
|
info(content: ConfigContent, duration?: ConfigDuration, onClose?: () => ConfigOnClose) {
|
||||||
return notice(content, duration, 'info', onClose);
|
return notice(content, duration, 'info', onClose);
|
||||||
},
|
},
|
||||||
success(content: ConfigContent, duration?: ConfigDuration, onClose?: ConfigOnClose) {
|
success(content: ConfigContent, duration?: ConfigDuration, onClose?: ConfigOnClose) {
|
||||||
|
15
components/notification/index.tsx
Normal file → Executable file
15
components/notification/index.tsx
Normal file → Executable file
@ -92,8 +92,19 @@ function notice(args) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const api = {
|
const api: {
|
||||||
open(args) {
|
success?(args: ArgsProps): void;
|
||||||
|
error?(args: ArgsProps): void;
|
||||||
|
info?(args: ArgsProps): void;
|
||||||
|
warn?(args: ArgsProps): void;
|
||||||
|
warning?(args: ArgsProps): void;
|
||||||
|
|
||||||
|
open(args: ArgsProps): void;
|
||||||
|
close(key: string): void;
|
||||||
|
config(options: ConfigProps): void;
|
||||||
|
destroy(): void;
|
||||||
|
} = {
|
||||||
|
open(args: ArgsProps) {
|
||||||
notice(args);
|
notice(args);
|
||||||
},
|
},
|
||||||
close(key) {
|
close(key) {
|
||||||
|
5
components/select/index.tsx
Normal file → Executable file
5
components/select/index.tsx
Normal file → Executable file
@ -35,7 +35,7 @@ export interface SelectProps {
|
|||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
dropdownStyle?: React.CSSProperties;
|
dropdownStyle?: React.CSSProperties;
|
||||||
dropdownMenuStyle?: React.CSSProperties;
|
dropdownMenuStyle?: React.CSSProperties;
|
||||||
onChange?: (value) => void;
|
onChange?: (value: SelectValue) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OptionProps {
|
export interface OptionProps {
|
||||||
@ -53,7 +53,8 @@ export interface SelectContext {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Option, OptGroup };
|
// => It is needless to export the declaration of below two inner components.
|
||||||
|
// export { Option, OptGroup };
|
||||||
|
|
||||||
export default class Select extends React.Component<SelectProps, any> {
|
export default class Select extends React.Component<SelectProps, any> {
|
||||||
static Option = Option as React.ClassicComponentClass<OptionProps>;
|
static Option = Option as React.ClassicComponentClass<OptionProps>;
|
||||||
|
1
components/switch/index.tsx
Normal file → Executable file
1
components/switch/index.tsx
Normal file → Executable file
@ -12,6 +12,7 @@ export interface SwitchProps {
|
|||||||
onChange?: (checked: boolean) => any;
|
onChange?: (checked: boolean) => any;
|
||||||
checkedChildren?: React.ReactNode;
|
checkedChildren?: React.ReactNode;
|
||||||
unCheckedChildren?: React.ReactNode;
|
unCheckedChildren?: React.ReactNode;
|
||||||
|
disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Switch extends React.Component<SwitchProps, any> {
|
export default class Switch extends React.Component<SwitchProps, any> {
|
||||||
|
2
components/table/Table.tsx
Normal file → Executable file
2
components/table/Table.tsx
Normal file → Executable file
@ -750,7 +750,7 @@ export default class Table extends React.Component<TableProps, any> {
|
|||||||
const { pagination } = this.state;
|
const { pagination } = this.state;
|
||||||
if (pagination.size) {
|
if (pagination.size) {
|
||||||
size = pagination.size;
|
size = pagination.size;
|
||||||
} else if (this.props.size === 'middle' || this.props.size === 'small') {
|
} else if (this.props.size as string === 'middle' || this.props.size === 'small') {
|
||||||
size = 'small';
|
size = 'small';
|
||||||
}
|
}
|
||||||
let total = pagination.total || this.getLocalData().length;
|
let total = pagination.total || this.getLocalData().length;
|
||||||
|
2
components/table/filterDropdown.tsx
Normal file → Executable file
2
components/table/filterDropdown.tsx
Normal file → Executable file
@ -6,7 +6,7 @@ import Checkbox from '../checkbox';
|
|||||||
import Radio from '../radio';
|
import Radio from '../radio';
|
||||||
|
|
||||||
export interface FilterDropdownMenuWrapperProps {
|
export interface FilterDropdownMenuWrapperProps {
|
||||||
onClick?: Function;
|
onClick?: React.MouseEventHandler;
|
||||||
children?: any;
|
children?: any;
|
||||||
className?: string;
|
className?: string;
|
||||||
}
|
}
|
||||||
|
2
components/tabs/index.tsx
Normal file → Executable file
2
components/tabs/index.tsx
Normal file → Executable file
@ -75,7 +75,7 @@ export default class Tabs extends React.Component<TabsProps, any> {
|
|||||||
} = this.props;
|
} = this.props;
|
||||||
let className = classNames({
|
let className = classNames({
|
||||||
[this.props.className]: !!this.props.className,
|
[this.props.className]: !!this.props.className,
|
||||||
[`${prefixCls}-mini`]: size === 'small' || size === 'mini',
|
[`${prefixCls}-mini`]: size === 'small' || size as string === 'mini',
|
||||||
[`${prefixCls}-vertical`]: tabPosition === 'left' || tabPosition === 'right',
|
[`${prefixCls}-vertical`]: tabPosition === 'left' || tabPosition === 'right',
|
||||||
[`${prefixCls}-card`]: type.indexOf('card') >= 0,
|
[`${prefixCls}-card`]: type.indexOf('card') >= 0,
|
||||||
[`${prefixCls}-${type}`]: true,
|
[`${prefixCls}-${type}`]: true,
|
||||||
|
2
components/upload/interface.tsx
Normal file → Executable file
2
components/upload/interface.tsx
Normal file → Executable file
@ -30,7 +30,7 @@ export interface UploadProps {
|
|||||||
defaultFileList?: Array<File>;
|
defaultFileList?: Array<File>;
|
||||||
fileList?: Array<File>;
|
fileList?: Array<File>;
|
||||||
action: string;
|
action: string;
|
||||||
data?: Object | ((File) => any);
|
data?: Object | ((file: File) => any);
|
||||||
headers?: HttpRequestHeader;
|
headers?: HttpRequestHeader;
|
||||||
showUploadList?: boolean;
|
showUploadList?: boolean;
|
||||||
multiple?: boolean;
|
multiple?: boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user