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

Function createPromiseType

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

Source from the content-addressed store, hash-verified

77770 }
77771 }
77772 function createPromiseType(promisedType) {
77773 // creates a `Promise<T>` type where `T` is the promisedType argument
77774 var globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true);
77775 if (globalPromiseType !== emptyGenericType) {
77776 // if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type
77777 // Unwrap an `Awaited<T>` to `T` to improve inference.
77778 promisedType = getAwaitedTypeNoAlias(unwrapAwaitedType(promisedType)) || unknownType;
77779 return createTypeReference(globalPromiseType, [promisedType]);
77780 }
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);

Callers 4

elaborateArrowFunctionFunction · 0.85
createPromiseReturnTypeFunction · 0.85
getReturnTypeFromBodyFunction · 0.85

Calls 4

getGlobalPromiseTypeFunction · 0.85
getAwaitedTypeNoAliasFunction · 0.85
unwrapAwaitedTypeFunction · 0.85
createTypeReferenceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…