]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore(types): removed the Awaited compatibility type tool (#11820)
author远方os <yangpanteng@gmail.com>
Thu, 5 Sep 2024 08:09:10 +0000 (16:09 +0800)
committerGitHub <noreply@github.com>
Thu, 5 Sep 2024 08:09:10 +0000 (16:09 +0800)
packages/runtime-core/src/scheduler.ts
packages/shared/src/typeUtils.ts

index 7f52a77bd50823b4db00803f1eea34e20b0a5cac..727eb14e310ec48ae88b055b8a41ff21912345f2 100644 (file)
@@ -1,5 +1,5 @@
 import { ErrorCodes, callWithErrorHandling, handleError } from './errorHandling'
-import { type Awaited, NOOP, isArray } from '@vue/shared'
+import { NOOP, isArray } from '@vue/shared'
 import { type ComponentInternalInstance, getComponentName } from './component'
 
 export enum SchedulerJobFlags {
index 4846751b84e9370f8db7ebe425cbf126c3c82899..1fd161ceb05617890b9e62d03dc99a2040ec8836 100644 (file)
@@ -13,15 +13,6 @@ export type LooseRequired<T> = { [P in keyof (T & Required<T>)]: T[P] }
 // https://stackoverflow.com/questions/49927523/disallow-call-with-any/49928360#49928360
 export type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N
 
-// To prevent users with TypeScript versions lower than 4.5 from encountering unsupported Awaited<T> type, a copy has been made here.
-export type Awaited<T> = T extends null | undefined
-  ? T // special case for `null | undefined` when not in `--strictNullChecks` mode
-  : T extends object & { then(onfulfilled: infer F, ...args: infer _): any } // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped
-    ? F extends (value: infer V, ...args: infer _) => any // if the argument to `then` is callable, extracts the first argument
-      ? Awaited<V> // recursively unwrap the value
-      : never // the argument to `then` was not callable
-    : T // non-object or non-thenable
-
 /**
  * Utility for extracting the parameters from a function overload (for typed emits)
  * https://github.com/microsoft/TypeScript/issues/32164#issuecomment-1146737709