MCPcopy Index your code
hub / github.com/nodejs/node / createPromiseLikeType

Function createPromiseLikeType

test/fixtures/snapshot/typescript.js:77783–77793  ·  view source on GitHub ↗
(promisedType)

Source from the content-addressed store, hash-verified

77781 return unknownType;
77782 }
77783 function createPromiseLikeType(promisedType) {
77784 // creates a `PromiseLike<T>` type where `T` is the promisedType argument
77785 var globalPromiseLikeType = getGlobalPromiseLikeType(/*reportErrors*/ true);
77786 if (globalPromiseLikeType !== emptyGenericType) {
77787 // if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type
77788 // Unwrap an `Awaited<T>` to `T` to improve inference.
77789 promisedType = getAwaitedTypeNoAlias(unwrapAwaitedType(promisedType)) || unknownType;
77790 return createTypeReference(globalPromiseLikeType, [promisedType]);
77791 }
77792 return unknownType;
77793 }
77794 function createPromiseReturnType(func, promisedType) {
77795 var promiseType = createPromiseType(promisedType);
77796 if (promiseType === unknownType) {

Calls 4

getGlobalPromiseLikeTypeFunction · 0.85
getAwaitedTypeNoAliasFunction · 0.85
unwrapAwaitedTypeFunction · 0.85
createTypeReferenceFunction · 0.85

Tested by

no test coverage detected