sindresorhus/electron-better-ipc

Better Typescript Support

Open

#45 创建于 2022年7月20日

在 GitHub 查看
 (5 评论) (0 反应) (0 负责人)JavaScript (53 fork)user submission
enhancementhelp wanted

仓库指标

Star
 (744 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

It'd be lovely if this library came with excellent Typescript support, where one can define which "ipc methods" actually exist. Like being able to say

type MainIpc = {
  "get-emoji"(name: string): string;
};

Then doing a bit to annotate the IPC with said types, like const ipc: SafeMainProcessIpc<MainIpc, RendererIpc> = ipcMain;

After that, one could have excellent autocomplete and Typescript errors if something doesn't add up. image

贡献者指南