sindresorhus/electron-better-ipc

Better Typescript Support

Open

#45 opened on Jul 20, 2022

View on GitHub
 (5 comments) (0 reactions) (0 assignees)JavaScript (53 forks)user submission
enhancementhelp wanted

Repository metrics

Stars
 (744 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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

Contributor guide