fix: optimized type (#38925)

This commit is contained in:
thinkasany 2022-11-24 10:08:44 +08:00 committed by GitHub
parent 5148b01183
commit 98041591ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,7 +67,7 @@ class Affix extends React.Component<InternalAffixProps, AffixState> {
fixedNode: HTMLDivElement;
private timeout: any;
private timeout: NodeJS.Timeout | null;
context: ConfigConsumerProps;
@ -124,7 +124,10 @@ class Affix extends React.Component<InternalAffixProps, AffixState> {
}
componentWillUnmount() {
clearTimeout(this.timeout);
if (this.timeout) {
clearTimeout(this.timeout);
this.timeout = null;
}
removeObserveTarget(this);
this.updatePosition.cancel();
// https://github.com/ant-design/ant-design/issues/22683