mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 09:26:06 +08:00
Fix implicit any error for Anchor
This commit is contained in:
parent
c27d4deb72
commit
c0a42480ae
@ -1,4 +1,4 @@
|
||||
export default function getScroll(target, top): number {
|
||||
export default function getScroll(target: any, top: boolean): number {
|
||||
if (typeof window === 'undefined') {
|
||||
return 0;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ function easeInOutCubic(t: number, b: number, c: number, d: number) {
|
||||
}
|
||||
|
||||
const reqAnimFrame = getRequestAnimationFrame();
|
||||
function scrollTo(href: string, offsetTop = 0, target, callback = () => { }) {
|
||||
function scrollTo(href: string, offsetTop = 0, target: () => Window | HTMLElement, callback = () => { }) {
|
||||
const scrollTop = getScroll(target(), true);
|
||||
const targetElement = document.getElementById(href.substring(1));
|
||||
if (!targetElement) {
|
||||
@ -95,7 +95,7 @@ export default class Anchor extends React.Component<AnchorProps, any> {
|
||||
antAnchor: PropTypes.object,
|
||||
};
|
||||
|
||||
private inkNode: HTMLElement;
|
||||
private inkNode: HTMLSpanElement;
|
||||
|
||||
private links: String[];
|
||||
private scrollEvent: any;
|
||||
@ -155,7 +155,7 @@ export default class Anchor extends React.Component<AnchorProps, any> {
|
||||
});
|
||||
}
|
||||
|
||||
handleScrollTo = (link) => {
|
||||
handleScrollTo = (link: string) => {
|
||||
const { offsetTop, target = getDefaultTarget } = this.props;
|
||||
this.animating = true;
|
||||
this.setState({ activeLink: link });
|
||||
@ -200,7 +200,7 @@ export default class Anchor extends React.Component<AnchorProps, any> {
|
||||
}
|
||||
}
|
||||
|
||||
saveInkNode = (node) => {
|
||||
saveInkNode = (node: HTMLSpanElement) => {
|
||||
this.inkNode = node;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user