如何编写异步类型断言函数?

Ian*_*Ian 5 syntax types asynchronous type-assertion typescript

从 TypeScript 3.7 开始,我们可以编写一个类型断言函数,如下所示:

function assertsIsArray(x: any): asserts x extends Array<any> {
  if(!Array.isArray(x)) throw new Error();
}
Run Code Online (Sandbox Code Playgroud)

但是,该asserts子句取代了函数声明中的返回类型语句。通常不需要从这些函数返回,但这使得声明async函数显然是不可能的:

async function assertsIsArray(x: any): asserts x extends Array<any> {
  if(!Array.isArray(x)) throw new Error();
}

// Type 'void' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
Run Code Online (Sandbox Code Playgroud)

通常,验证需要异步(即使用yup)。如何制作异步类型断言方法?