@wuchuheng/electron
Version:
Electron project template
44 lines (37 loc) • 1.38 kB
TypeScript
// AUTO-GENERATED BY scripts/sync-ipc-types.js - DO NOT EDIT MANUALLY
/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable @typescript-eslint/no-explicit-any */
type Awaitable<T> = T extends Promise<infer R> ? Promise<R> : Promise<T>;
type ToRendererMethod<T> = T extends { _isEvent: true }
? (listener: (payload: Parameters<T>[0]) => void) => () => void
: (...args: Parameters<T>) => Awaitable<ReturnType<T>>;
type IpcModules = {
system: {
bootloading: typeof import('../main/ipc/system/bootloading.ipc').default;
getBootloadProgressing: typeof import('../main/ipc/system/getBootloadProgressing.ipc').default;
};
tmp: {
getTmp: typeof import('../main/ipc/tmp/getTmp.ipc').default;
getTmp2: typeof import('../main/ipc/tmp/getTmp2.ipc').default;
};
welcome: {
getWelcome: typeof import('../main/ipc/welcome/getWelcome.ipc').default;
};
window: {
close: typeof import('../main/ipc/window/close.ipc').default;
maximize: typeof import('../main/ipc/window/maximize.ipc').default;
minimize: typeof import('../main/ipc/window/minimize.ipc').default;
};
};
type RendererApi<T> = {
[M in keyof T]: {
[K in keyof T[M]]: ToRendererMethod<T[M][K]>;
};
};
export type GeneratedElectronApi = RendererApi<IpcModules>;
declare global {
interface Window {
electron: GeneratedElectronApi;
}
}
export {};