mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 04:29:20 +08:00
9 lines
235 B
TypeScript
9 lines
235 B
TypeScript
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;
|
|
}
|