xiaoyi
6 天以前 5c243d9d05da668a32b1bc9a4f543ea081488d11
1
2
3
4
5
6
7
8
export type Awaitable<T> = Promise<T> | T;
 
export async function interopDefault<T>(
  m: Awaitable<T>,
): Promise<T extends { default: infer U } ? U : T> {
  const resolved = await m;
  return (resolved as any).default || resolved;
}