function Promise.prototype.awaitStatus(r)r._unhandledRejection=false if r._status==Promise.Status.Started then local i=coroutine.running();(r:finally(function()task.spawn(i)end)):catch(function() end)coroutine.yield()end if r._status==Promise.Status.Resolved then return r._status,unpack(r._values,1,r._valuesLength)elseif r._status==Promise.Status.Rejected then return r._status,unpack(r._values,1,r._valuesLength)end return r._status end local function r(r,...)return r==Promise.Status.Resolved,...end
--[=[
	Yields the current thread until the given Promise completes. Returns the Promise's status, followed by the values that the promise resolved or rejected with.

	@yields
	@return Status -- The Status representing the fate of the Promise
	@return ...any -- The values the Promise resolved or rejected with.
]=]
function Promise.prototype:awaitStatus()
	self._unhandledRejection = false

	if self._status == Promise.Status.Started then
		local thread = coroutine.running()

		self
			:finally(function()
				task.spawn(thread)
			end)
			-- The finally promise can propagate rejections, so we attach a catch handler to prevent the unhandled
			-- rejection warning from appearing
			:catch(
				function() end
			)

		coroutine.yield()
	end

	if self._status == Promise.Status.Resolved then
		return self._status, unpack(self._values, 1, self._valuesLength)
	elseif self._status == Promise.Status.Rejected then
		return self._status, unpack(self._values, 1, self._valuesLength)
	end

	return self._status
end

local function awaitHelper(status, ...)
	return status == Promise.Status.Resolved, ...
end
