Skip to content

Commit c518517

Browse files
chore(types): removed the Awaited compatibility type tool (#11820)
1 parent 1b6bc23 commit c518517

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

packages/runtime-core/src/scheduler.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ErrorCodes, callWithErrorHandling, handleError } from './errorHandling'
2-
import { type Awaited, NOOP, isArray } from '@vue/shared'
2+
import { NOOP, isArray } from '@vue/shared'
33
import { type ComponentInternalInstance, getComponentName } from './component'
44

55
export enum SchedulerJobFlags {

packages/shared/src/typeUtils.ts

-9
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@ export type LooseRequired<T> = { [P in keyof (T & Required<T>)]: T[P] }
1313
// https://stackoverflow.com/questions/49927523/disallow-call-with-any/49928360#49928360
1414
export type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N
1515

16-
// To prevent users with TypeScript versions lower than 4.5 from encountering unsupported Awaited<T> type, a copy has been made here.
17-
export type Awaited<T> = T extends null | undefined
18-
? T // special case for `null | undefined` when not in `--strictNullChecks` mode
19-
: 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
20-
? F extends (value: infer V, ...args: infer _) => any // if the argument to `then` is callable, extracts the first argument
21-
? Awaited<V> // recursively unwrap the value
22-
: never // the argument to `then` was not callable
23-
: T // non-object or non-thenable
24-
2516
/**
2617
* Utility for extracting the parameters from a function overload (for typed emits)
2718
* https://github.com/microsoft/TypeScript/issues/32164#issuecomment-1146737709

0 commit comments

Comments
 (0)