dify-proxy-fontend/internal/lint-configs/eslint-config/src/util.ts
2025-05-02 22:08:36 +08:00

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;
}