Skip to content

Commit

Permalink
chore: fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
israx committed Jan 16, 2024
1 parent a717e20 commit b46967d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/core/src/utils/deDupeAsyncRequests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

// this will make the tsc-complience-test to pass
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; //
/**
* returns inflight promise if there hasn't been resolved yet
*
Expand Down

0 comments on commit b46967d

Please sign in to comment.