MCPcopy Create free account
hub / github.com/nodejs/node / isThenableType

Function isThenableType

test/fixtures/snapshot/typescript.js:81329–81336  ·  view source on GitHub ↗

* Determines whether a type is an object with a callable `then` member.

(type)

Source from the content-addressed store, hash-verified

81327 * Determines whether a type is an object with a callable `then` member.
81328 */
81329 function isThenableType(type) {
81330 if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
81331 // primitive types cannot be considered "thenable" since they are not objects.
81332 return false;
81333 }
81334 var thenFunction = getTypeOfPropertyOfType(type, "then");
81335 return !!thenFunction && getSignaturesOfType(getTypeWithFacts(thenFunction, 2097152 /* TypeFacts.NEUndefinedOrNull */), 0 /* SignatureKind.Call */).length > 0;
81336 }
81337 function isAwaitedTypeInstantiation(type) {
81338 var _a;
81339 if (type.flags & 16777216 /* TypeFlags.Conditional */) {

Callers 2

getAwaitedTypeNoAliasFunction · 0.85

Calls 4

allTypesAssignableToKindFunction · 0.85
getTypeOfPropertyOfTypeFunction · 0.85
getSignaturesOfTypeFunction · 0.85
getTypeWithFactsFunction · 0.85

Tested by

no test coverage detected