diff --git a/components/affix/index.tsx b/components/affix/index.tsx index dd6d36510a..09bc9cb9e8 100644 --- a/components/affix/index.tsx +++ b/components/affix/index.tsx @@ -138,12 +138,12 @@ export default class Affix extends React.Component { const targetRect = getTargetRect(targetNode); const targetInnerHeight = (targetNode as Window).innerHeight || (targetNode as HTMLElement).clientHeight; - if (scrollTop > elemOffset.top - offsetTop && offsetMode.top) { + if (scrollTop > elemOffset.top - (offsetTop as number) && offsetMode.top) { // Fixed Top const width = elemOffset.width; this.setAffixStyle(e, { position: 'fixed', - top: targetRect.top + offsetTop, + top: targetRect.top + (offsetTop as number), left: targetRect.left + elemOffset.left, width, }); @@ -152,7 +152,7 @@ export default class Affix extends React.Component { height: affixNode.offsetHeight, }); } else if ( - scrollTop < elemOffset.top + elemSize.height + offsetBottom - targetInnerHeight && + scrollTop < elemOffset.top + elemSize.height + (offsetBottom as number) - targetInnerHeight && offsetMode.bottom ) { // Fixed Bottom @@ -160,7 +160,7 @@ export default class Affix extends React.Component { const width = elemOffset.width; this.setAffixStyle(e, { position: 'fixed', - bottom: targetBottomOffet + offsetBottom, + bottom: targetBottomOffet + (offsetBottom as number), left: targetRect.left + elemOffset.left, width, }); diff --git a/components/back-top/index.tsx b/components/back-top/index.tsx index 6d7fd0702b..8dad273f2f 100755 --- a/components/back-top/index.tsx +++ b/components/back-top/index.tsx @@ -82,7 +82,7 @@ export default class BackTop extends React.Component { const { visibilityHeight, target = getDefaultTarget } = this.props; const scrollTop = getScroll(target(), true); this.setState({ - visible: scrollTop > visibilityHeight, + visible: scrollTop > (visibilityHeight as number), }); } diff --git a/components/badge/index.tsx b/components/badge/index.tsx index fba7e96de5..2f01d2ab40 100644 --- a/components/badge/index.tsx +++ b/components/badge/index.tsx @@ -53,7 +53,7 @@ export default class Badge extends React.Component { ...restProps, } = this.props; const isDot = dot || status; - let displayCount = count > overflowCount ? `${overflowCount}+` : count; + let displayCount = count > (overflowCount as number) ? `${overflowCount}+` : count; // dot mode don't need count if (isDot) { displayCount = ''; diff --git a/components/calendar/Header.tsx b/components/calendar/Header.tsx index 9fffa57ae1..88d19f576a 100644 --- a/components/calendar/Header.tsx +++ b/components/calendar/Header.tsx @@ -26,8 +26,8 @@ export default class Header extends React.Component { getYearSelectElement(year) { const { yearSelectOffset, yearSelectTotal, locale, prefixCls, fullscreen } = this.props; - const start = year - yearSelectOffset; - const end = start + yearSelectTotal; + const start = year - (yearSelectOffset as number); + const end = start + (yearSelectTotal as number); const suffix = locale.year === '年' ? '年' : ''; const options: React.ReactElement[] = []; diff --git a/components/grid/row.tsx b/components/grid/row.tsx index c78d79d646..d0c7cc0fc4 100644 --- a/components/grid/row.tsx +++ b/components/grid/row.tsx @@ -17,6 +17,7 @@ export default class Row extends React.Component { static defaultProps = { gutter: 0, }; + static propTypes = { type: React.PropTypes.string, align: React.PropTypes.string, @@ -27,16 +28,17 @@ export default class Row extends React.Component { prefixCls: React.PropTypes.string, }; render() { - const { type, justify, align, className, gutter, style, children, prefixCls = 'ant-row', ...others } = this.props; + const { type, justify, align, className, gutter, style, children, + prefixCls = 'ant-row', ...others } = this.props; const classes = classNames({ [prefixCls]: !type, [`${prefixCls}-${type}`]: type, [`${prefixCls}-${type}-${justify}`]: type && justify, [`${prefixCls}-${type}-${align}`]: type && align, }, className); - const rowStyle = gutter > 0 ? assign({}, { - marginLeft: gutter / -2, - marginRight: gutter / -2, + const rowStyle = (gutter as number) > 0 ? assign({}, { + marginLeft: (gutter as number) / -2, + marginRight: (gutter as number) / -2, }, style) : style; const cols = Children.map(children, (col: React.ReactElement) => { if (!col) { @@ -44,9 +46,9 @@ export default class Row extends React.Component { } if (col.props) { return cloneElement(col, { - style: gutter > 0 ? assign({}, { - paddingLeft: gutter / 2, - paddingRight: gutter / 2, + style: (gutter as number) > 0 ? assign({}, { + paddingLeft: (gutter as number) / 2, + paddingRight: (gutter as number) / 2, }, col.props.style) : col.props.style, }); } diff --git a/components/input/Search.tsx b/components/input/Search.tsx index d88ce7cc79..5973d89f1d 100644 --- a/components/input/Search.tsx +++ b/components/input/Search.tsx @@ -32,7 +32,7 @@ export default class Search extends React.Component { } render() { const { className, prefixCls, ...others } = this.props; - delete others.onSearch; + delete (others as any).onSearch; const searchSuffix = ( ; onSearchChange?: Function; onChange?: Function; notFoundContent?: any; loading?: Boolean; - style?: Object; + style?: React.CSSProperties; defaultValue?: any; value?: any; className?: string; diff --git a/components/pagination/Pagination.tsx b/components/pagination/Pagination.tsx index 33f82e387c..45738e7dac 100644 --- a/components/pagination/Pagination.tsx +++ b/components/pagination/Pagination.tsx @@ -28,7 +28,7 @@ export interface PaginationProps { /** 当为「small」时,是小尺寸分页 */ size?: string; /** 当添加该属性时,显示为简单分页*/ - simple?: Object; + simple?: boolean; /** 用于显示总共有多少条数据*/ showTotal?: (total: number) => React.ReactNode; style?: React.CSSProperties; diff --git a/components/pagination/index.en-US.md b/components/pagination/index.en-US.md index 503c1c9acf..5d03c31bdb 100644 --- a/components/pagination/index.en-US.md +++ b/components/pagination/index.en-US.md @@ -31,5 +31,5 @@ pageSizeOptions | specify the sizeChanger selections | string[] | ['10', '20', ' onShowSizeChange | a callback function, can be executed when `pageSize` is changing | Function(current, size) | noop showQuickJumper | determine whether you can jump to a page directly | boolean | false size | specify the size of `Pagination`, can be set to `small` | string | "" -simple | whether to use simple mode | object | - +simple | whether to use simple mode | boolean | - showTotal | to display the total number and range | Function(total, range) | - diff --git a/components/pagination/index.zh-CN.md b/components/pagination/index.zh-CN.md index a5c676ee63..7ce249f146 100644 --- a/components/pagination/index.zh-CN.md +++ b/components/pagination/index.zh-CN.md @@ -32,5 +32,5 @@ cols: 1 | onShowSizeChange | pageSize 变化的回调 | Function(current, size) | noop | | showQuickJumper | 是否可以快速跳转至某页 | boolean | false | | size | 当为「small」时,是小尺寸分页 | string | "" | -| simple | 当添加该属性时,显示为简单分页 | object | - | +| simple | 当添加该属性时,显示为简单分页 | boolean | - | | showTotal | 用于显示数据总量和当前数据顺序 | Function(total, range) | - | diff --git a/components/tag/CheckableTag.tsx b/components/tag/CheckableTag.tsx index edd8a35060..6a9b607a9c 100644 --- a/components/tag/CheckableTag.tsx +++ b/components/tag/CheckableTag.tsx @@ -22,7 +22,7 @@ export default class CheckableTag extends React.Component; } } diff --git a/package.json b/package.json index d74a198910..d5565b631c 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "@types/react": "^15.0.8", "@types/react-dom": "~0.14.18", "antd-demo-jest": "^1.0.5", - "antd-tools": "~0.16.0", + "antd-tools": "~0.18.0", "babel-cli": "^6.18.0", "babel-eslint": "^7.1.0", "babel-jest": "^17.0.0", @@ -133,7 +133,7 @@ "rimraf": "^2.5.4", "stylelint": "^7.8.0", "stylelint-config-standard": "^16.0.0", - "typescript": "~2.1.6", + "typescript": "~2.2.1", "typescript-babel-jest": "^0.1.5", "values.js": "^1.0.3", "xhr2": "^0.1.3"