fix typescript errors

This commit is contained in:
afc163 2018-11-09 17:38:19 +08:00
parent 15d3070275
commit 9b9c4c7dec
8 changed files with 14 additions and 1 deletions

View File

@ -38,7 +38,7 @@ export interface CheckboxChangeEvent {
nativeEvent: MouseEvent;
}
export default class Checkbox extends React.Component<CheckboxProps, {}> {
export default class Checkbox extends React.Component<CheckboxProps, {}, {}> {
static Group: typeof CheckboxGroup;
static defaultProps = {
prefixCls: 'ant-checkbox',
@ -49,6 +49,8 @@ export default class Checkbox extends React.Component<CheckboxProps, {}> {
checkboxGroup: PropTypes.any,
};
context: any;
private rcCheckbox: any;
shouldComponentUpdate(nextProps: CheckboxProps, nextState: {}, nextContext: CheckboxGroupContext) {

View File

@ -100,6 +100,8 @@ class Sider extends React.Component<SiderProps, SiderState> {
return null;
}
context: any;
private mql: MediaQueryList;
private uniqueId: string;

View File

@ -74,6 +74,8 @@ export default class Item extends React.Component<ListItemProps, any> {
grid: PropTypes.any,
};
context: any;
render() {
const { grid } = this.context;
const { prefixCls = 'ant-list', children, actions, extra, className, ...others } = this.props;

View File

@ -8,6 +8,7 @@ class MenuItem extends React.Component<any, any> {
inlineCollapsed: PropTypes.bool,
};
static isMenuItem = 1;
context: any;
private menuItem: any;
onKeyDown = (e: React.MouseEvent<HTMLElement>) => {
this.menuItem.onKeyDown(e);

View File

@ -9,6 +9,7 @@ class SubMenu extends React.Component<any, any> {
};
// fix issue:https://github.com/ant-design/ant-design/issues/8666
static isSubMenu = 1;
context: any;
private subMenu: any;
onKeyDown = (e: React.MouseEvent<HTMLElement>) => {
this.subMenu.onKeyDown(e);

View File

@ -77,6 +77,7 @@ export default class Menu extends React.Component<MenuProps, MenuState> {
siderCollapsed: PropTypes.bool,
collapsedWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
};
context: any;
switchingModeFromInline: boolean;
inlineOpenKeys: string[] = [];
constructor(props: MenuProps) {

View File

@ -20,6 +20,8 @@ export default class Radio extends React.Component<RadioProps, {}> {
radioGroup: PropTypes.any,
};
context: any;
private rcCheckbox: any;
shouldComponentUpdate(nextProps: RadioProps, nextState: {}, nextContext: RadioGroupContext) {

View File

@ -15,6 +15,8 @@ export default class RadioButton extends React.Component<RadioButtonProps, any>
radioGroup: PropTypes.any,
};
context: any;
render() {
const radioProps: RadioButtonProps = { ...this.props };
if (this.context.radioGroup) {