Browse Source

remove `any` type in Tag (#7015)

pull/7019/head
Randy 7 years ago
committed by Wei Zhu
parent
commit
35ae41f618
  1. 2
      components/tag/CheckableTag.tsx
  2. 14
      components/tag/index.tsx

2
components/tag/CheckableTag.tsx

@ -8,7 +8,7 @@ export interface CheckableTagProps {
onChange?: (checked: Boolean) => void;
}
export default class CheckableTag extends React.Component<CheckableTagProps, any> {
export default class CheckableTag extends React.Component<CheckableTagProps> {
handleClick = () => {
const { checked, onChange } = this.props;
if (onChange) {

14
components/tag/index.tsx

@ -19,7 +19,12 @@ export interface TagProps {
style?: React.CSSProperties;
}
export default class Tag extends React.Component<TagProps, any> {
export interface TagState {
closing: boolean;
closed: boolean;
}
export default class Tag extends React.Component<TagProps, TagState> {
static CheckableTag = CheckableTag;
static defaultProps = {
prefixCls: 'ant-tag',
@ -35,7 +40,7 @@ export default class Tag extends React.Component<TagProps, any> {
};
}
close = (e) => {
close = (e: React.MouseEvent<HTMLElement>) => {
const onClose = this.props.onClose;
if (onClose) {
onClose(e);
@ -52,7 +57,7 @@ export default class Tag extends React.Component<TagProps, any> {
});
}
animationEnd = (_, existed) => {
animationEnd = (_: string, existed: boolean) => {
if (!existed && !this.state.closed) {
this.setState({
closed: true,
@ -66,7 +71,8 @@ export default class Tag extends React.Component<TagProps, any> {
}
}
isPresetColor(color) {
isPresetColor(color?: string): boolean {
if (!color) { return false; }
return /^(pink|red|yellow|orange|cyan|green|blue|purple)(-inverse)?$/.test(color);
}

Loading…
Cancel
Save