code: function checkCorrectPromiseType(returnType, location) {
              if (returnType === unknownType) {
                  // The return type already had some other error, so we ignore and return
                  // the unknown type.
                  return unknownType;
              }
              var globalPromiseType = getGlobalPromiseType();
              if (globalPromiseType === emptyGenericType
                  || globalPromiseType === getTargetType(returnType)) {
                  // Either we couldn't resolve the global promise type, which would have already
                  // reported an error, or we could resolve it and the return type is a valid type
                  // reference to the global type. In either case, we return the awaited type for
                  // the return type.
                  return checkAwaitedType(returnType, location, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type);
              }
              // The promise type was not a valid type reference to the global promise type, so we
              // report an error and return the unknown type.
              error(location, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type);
              return unknownType;
          }
docs: Checks that the return type provided is an instantiation of the global Promise<T> type
  and returns the awaited type of the return type.
  
  @param returnType The return type of a FunctionLikeDeclaration
  @param location The node on which to report the error.