Skip to content

Commit

Permalink
remove any type in Tag (ant-design#7015)
Browse files Browse the repository at this point in the history
  • Loading branch information
djyde authored and yesmeck committed Jul 30, 2017
1 parent bef7db4 commit 35ae41f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/tag/CheckableTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
14 changes: 10 additions & 4 deletions components/tag/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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);
Expand All @@ -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,
Expand All @@ -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);
}

Expand Down

0 comments on commit 35ae41f

Please sign in to comment.