hsy
4 天以前 09e6d1cfe124615cbea97140c17630c7b86a0796
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;
}