diff --git a/packages/compiler-ssr/src/transforms/ssrTransformSuspense.ts b/packages/compiler-ssr/src/transforms/ssrTransformSuspense.ts index c590eabea11..33543326922 100644 --- a/packages/compiler-ssr/src/transforms/ssrTransformSuspense.ts +++ b/packages/compiler-ssr/src/transforms/ssrTransformSuspense.ts @@ -32,7 +32,7 @@ export function ssrTransformSuspense( return () => { if (node.children.length) { const wipEntry: WIPEntry = { - slotsExp: null as any, + slotsExp: null!, // to be immediately set wipSlots: [] } wipMap.set(node, wipEntry) diff --git a/packages/runtime-core/src/components/BaseTransition.ts b/packages/runtime-core/src/components/BaseTransition.ts index cb628bf655a..dcc86cb475e 100644 --- a/packages/runtime-core/src/components/BaseTransition.ts +++ b/packages/runtime-core/src/components/BaseTransition.ts @@ -257,7 +257,7 @@ if (__COMPAT__) { // export the public type for h/tsx inference // also to avoid inline import() in generated d.ts files -export const BaseTransition = BaseTransitionImpl as any as { +export const BaseTransition = BaseTransitionImpl as unknown as { new (): { $props: BaseTransitionProps } diff --git a/packages/runtime-core/src/components/Suspense.ts b/packages/runtime-core/src/components/Suspense.ts index ffc900180fe..9db44f36baa 100644 --- a/packages/runtime-core/src/components/Suspense.ts +++ b/packages/runtime-core/src/components/Suspense.ts @@ -87,7 +87,9 @@ export const SuspenseImpl = { } // Force-casted public typing for h and TSX props inference -export const Suspense = (__FEATURE_SUSPENSE__ ? SuspenseImpl : null) as any as { +export const Suspense = (__FEATURE_SUSPENSE__ + ? SuspenseImpl + : null) as unknown as { __isSuspense: true new (): { $props: VNodeProps & SuspenseProps } } diff --git a/packages/runtime-core/src/components/Teleport.ts b/packages/runtime-core/src/components/Teleport.ts index 68d50a63fbd..69bf68cb84a 100644 --- a/packages/runtime-core/src/components/Teleport.ts +++ b/packages/runtime-core/src/components/Teleport.ts @@ -52,13 +52,13 @@ const resolveTarget = ( `ideally should be outside of the entire Vue component tree.` ) } - return target as any + return target as T } } else { if (__DEV__ && !targetSelector && !isTeleportDisabled(props)) { warn(`Invalid Teleport target: ${targetSelector}`) } - return targetSelector as any + return targetSelector as T } } @@ -371,7 +371,7 @@ function hydrateTeleport( } // Force-casted public typing for h and TSX props inference -export const Teleport = TeleportImpl as any as { +export const Teleport = TeleportImpl as unknown as { __isTeleport: true new (): { $props: VNodeProps & TeleportProps } } diff --git a/packages/runtime-dom/src/directives/vOn.ts b/packages/runtime-dom/src/directives/vOn.ts index d4567f839f4..06e596266cf 100644 --- a/packages/runtime-dom/src/directives/vOn.ts +++ b/packages/runtime-dom/src/directives/vOn.ts @@ -66,8 +66,7 @@ export const withKeys = (fn: Function, modifiers: string[]) => { compatUtils.isCompatEnabled(DeprecationTypes.CONFIG_KEY_CODES, instance) ) { if (instance) { - globalKeyCodes = (instance.appContext.config as any as LegacyConfig) - .keyCodes + globalKeyCodes = (instance.appContext.config as LegacyConfig).keyCodes } } if (__DEV__ && modifiers.some(m => /^\d+$/.test(m))) { diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts index 8c98b3b6cc4..f53150eb578 100644 --- a/packages/shared/src/index.ts +++ b/packages/shared/src/index.ts @@ -106,7 +106,7 @@ const cacheStringFunction = string>(fn: T): T => { return ((str: string) => { const hit = cache[str] return hit || (cache[str] = fn(str)) - }) as any + }) as T } const camelizeRE = /-(\w)/g diff --git a/packages/template-explorer/src/index.ts b/packages/template-explorer/src/index.ts index 683bf0452be..31f3faa5e47 100644 --- a/packages/template-explorer/src/index.ts +++ b/packages/template-explorer/src/index.ts @@ -241,5 +241,5 @@ function debounce any>( fn(...args) prevTimer = null }, delay) - }) as any + }) as T } diff --git a/packages/vue/__tests__/e2eUtils.ts b/packages/vue/__tests__/e2eUtils.ts index 583edb030ec..9ae3cc7fd3e 100644 --- a/packages/vue/__tests__/e2eUtils.ts +++ b/packages/vue/__tests__/e2eUtils.ts @@ -41,7 +41,7 @@ export function setupPuppeteer() { page.on('console', e => { if (e.type() === 'error') { - const err = e.args()[0] as any + const err = e.args()[0] console.error( `Error from Puppeteer-loaded page:\n`, err._remoteObject.description