import type { Awaitable } from '@pengzhanbo/utils'

/**
 * Interop default export
 *
 * 兼容默认导出
 */
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
}
