hsy
5 天以前 c8a6236013ec15d00ddcab1587bbd4f090611cdf
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;
}