From 96722605fd693dc0e4fbba85173c3e85ad5a3517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Fri, 14 Jul 2017 15:37:44 +0800 Subject: [PATCH] fix: noImplicitAny of back top (#6835) --- components/back-top/index.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/back-top/index.tsx b/components/back-top/index.tsx index de40725452..e518888441 100755 --- a/components/back-top/index.tsx +++ b/components/back-top/index.tsx @@ -9,7 +9,7 @@ import getRequestAnimationFrame from '../_util/getRequestAnimationFrame'; const reqAnimFrame = getRequestAnimationFrame(); -const easeInOutCubic = (t, b, c, d) => { +const easeInOutCubic = (t: number, b: number, c: number, d: number) => { const cc = c - b; t /= d / 2; if (t < 1) { @@ -19,7 +19,7 @@ const easeInOutCubic = (t, b, c, d) => { } }; -function noop() {} +function noop() { } function getDefaultTarget() { return typeof window !== 'undefined' ? @@ -42,7 +42,7 @@ export default class BackTop extends React.Component { scrollEvent: any; - constructor(props) { + constructor(props: BackTopProps) { super(props); this.state = { visible: false, @@ -57,7 +57,7 @@ export default class BackTop extends React.Component { return (targetNode as HTMLElement).scrollTop; } - scrollToTop = (e) => { + scrollToTop = (e: React.MouseEvent) => { const scrollTop = this.getCurrentScrollTop(); const startTime = Date.now(); const frameFunc = () => { @@ -72,7 +72,7 @@ export default class BackTop extends React.Component { (this.props.onClick || noop)(e); } - setScrollTop(value) { + setScrollTop(value: number) { const targetNode = (this.props.target || getDefaultTarget)(); if (targetNode === window) { document.body.scrollTop = value;