/
githubmirror
/
marktext
Обзор
Документация
Войти
/
githubmirror
/
marktext
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/desktop/src/main/utils/internalIpc.ts
13 строк
636 B
Ran Luo
refactor(desktop): remove remaining no-explicit-any suppressions (#4548)
17 июн 2026, 13:24
Не верифицирован
17 июн 2026, 13:24
2482e00
Код
Авторство
О чём код?
import { ipcMain } from 'electron' import type { IpcMainEvent } from 'electron' // Subscribe to an in-process channel dispatched via `ipcMain.emit(channel, ...args)`, // which forwards the payload args to listeners verbatim — there is no synthetic // `IpcMainEvent` like the renderer->main path that `ipcMain.on` is typed for. The // signature adaptation is contained here so callers keep real payload types. export function onInternalChannel<TArgs extends unknown[]>( channel: string, listener: (...args: TArgs) => void ): void { ipcMain.on(channel, listener as unknown as (event: IpcMainEvent, ...args: unknown[]) => void) }