function getPromisedType(promise) {
            //
            //  { // promise
            //      then( // thenFunction
            //          onfulfilled: ( // onfulfilledParameterType
            //              value: T // valueParameterType
            //          ) => any
            //      ): any;
            //  }
            //
            if (promise.flags & 1 /* Any */) {
                return undefined;
            }
            if ((promise.flags & 4096 /* Reference */) && promise.target === tryGetGlobalPromiseType()) {
                return promise.typeArguments[0];
            }
            var globalPromiseLikeType = getInstantiatedGlobalPromiseLikeType();
            if (globalPromiseLikeType === emptyObjectType || !isTypeAssignableTo(promise, globalPromiseLikeType)) {
                return undefined;
            }
            var thenFunction = getTypeOfPropertyOfType(promise, "then");
            if (thenFunction && (thenFunction.flags & 1 /* Any */)) {
                return undefined;
            }
            var thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0 /* Call */) : emptyArray;
            if (thenSignatures.length === 0) {
                return undefined;
            }
            var onfulfilledParameterType = getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature));
            if (onfulfilledParameterType.flags & 1 /* Any */) {
                return undefined;
            }
            var onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0 /* Call */);
            if (onfulfilledParameterSignatures.length === 0) {
                return undefined;
            }
            var valueParameterType = getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature));
            return valueParameterType;
        }
function getPromisedType(promise) {
            //
            //  { // promise
            //      then( // thenFunction
            //          onfulfilled: ( // onfulfilledParameterType
            //              value: T // valueParameterType
            //          ) => any
            //      ): any;
            //  }
            //
            if (promise.flags & 1 /* Any */) {
                return undefined;
            }
            if ((promise.flags & 4096 /* Reference */) && promise.target === tryGetGlobalPromiseType()) {
                return promise.typeArguments[0];
            }
            var globalPromiseLikeType = getInstantiatedGlobalPromiseLikeType();
            if (globalPromiseLikeType === emptyObjectType || !isTypeAssignableTo(promise, globalPromiseLikeType)) {
                return undefined;
            }
            var thenFunction = getTypeOfPropertyOfType(promise, "then");
            if (thenFunction && (thenFunction.flags & 1 /* Any */)) {
                return undefined;
            }
            var thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0 /* Call */) : emptyArray;
            if (thenSignatures.length === 0) {
                return undefined;
            }
            var onfulfilledParameterType = getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature));
            if (onfulfilledParameterType.flags & 1 /* Any */) {
                return undefined;
            }
            var onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0 /* Call */);
            if (onfulfilledParameterSignatures.length === 0) {
                return undefined;
            }
            var valueParameterType = getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature));
            return valueParameterType;
        }
function getPromisedType ( promise ) { // //  { // promise //      then( // thenFunction //          onfulfilled: ( // onfulfilledParameterType //              value: T // valueParameterType //          ) => any //      ): any; //  } // if ( promise . flags & 1 /* Any */ ) { return undefined ; } if ( ( promise . flags & 4096 /* Reference */ ) && promise . target === tryGetGlobalPromiseType ( ) ) { return promise . typeArguments [ 0 ] ; } var globalPromiseLikeType = getInstantiatedGlobalPromiseLikeType ( ) ; if ( globalPromiseLikeType === emptyObjectType || ! isTypeAssignableTo ( promise , globalPromiseLikeType ) ) { return undefined ; } var thenFunction = getTypeOfPropertyOfType ( promise , "then" ) ; if ( thenFunction && ( thenFunction . flags & 1 /* Any */ ) ) { return undefined ; } var thenSignatures = thenFunction ? getSignaturesOfType ( thenFunction , 0 /* Call */ ) : emptyArray ; if ( thenSignatures . length === 0 ) { return undefined ; } var onfulfilledParameterType = getUnionType ( ts . map ( thenSignatures , getTypeOfFirstParameterOfSignature ) ) ; if ( onfulfilledParameterType . flags & 1 /* Any */ ) { return undefined ; } var onfulfilledParameterSignatures = getSignaturesOfType ( onfulfilledParameterType , 0 /* Call */ ) ; if ( onfulfilledParameterSignatures . length === 0 ) { return undefined ; } var valueParameterType = getUnionType ( ts . map ( onfulfilledParameterSignatures , getTypeOfFirstParameterOfSignature ) ) ; return valueParameterType ; }
Gets the "promised type" of a promise.
@param type The type of the promise.
@remarks The "promised type" of a type is the type of the "value" parameter of the "onfulfilled" callback.
Gets the promised type of a promise .