From e22c78d682c50d88c56e8c9c6cf080ac0c1d9463 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Mon, 8 Jan 2024 10:22:31 -0500 Subject: [PATCH] chore: remove any and resolve lint (#28782) Issue number: Internal --------- ## What is the current behavior? As part of FW-2832 the team has an initiative to remove much of the `any` usage in favor of stronger types. This will make modifications to this codebase safer as we will have access to proper type checking. ## What is the new behavior? - Added stronger types to the `animationTimeout` variable. Making this change causes our linter to fail because we are using a number value in a conditional which we do not allow. To avoid this, I needed to check if `animationTimeout` was `undefined`. This should not cause any changes for Ionic developers, but I want to ship this a) in a separate patch and b) in a minor release to de-risk just in case there's an edge case I am not considering. ## Does this introduce a breaking change? - [ ] Yes - [x] No ## Other information --- core/src/utils/helpers.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/utils/helpers.ts b/core/src/utils/helpers.ts index ee5d8bcd10..92d43fc7a6 100644 --- a/core/src/utils/helpers.ts +++ b/core/src/utils/helpers.ts @@ -22,7 +22,7 @@ export const transitionEndAsync = (el: HTMLElement | null, expectedDuration = 0) */ const transitionEnd = (el: HTMLElement | null, expectedDuration = 0, callback: (ev?: TransitionEvent) => void) => { let unRegTrans: (() => void) | undefined; - let animationTimeout: any; + let animationTimeout: number | undefined; const opts: any = { passive: true }; const ANIMATION_FALLBACK_TIMEOUT = 500; @@ -45,7 +45,7 @@ const transitionEnd = (el: HTMLElement | null, expectedDuration = 0, callback: ( animationTimeout = setTimeout(onTransitionEnd, expectedDuration + ANIMATION_FALLBACK_TIMEOUT); unRegTrans = () => { - if (animationTimeout) { + if (animationTimeout !== undefined) { clearTimeout(animationTimeout); animationTimeout = undefined; }