如何为 Electron 安装打字稿定义?

How do I install typescript definitions for Electron?

我有两个问题:

需要将 source 设置为 dt,它似乎工作得很好。

$ typings install github-electron --source dt --global

我不得不使用不同的打字名称:

typings install electron/github-electron --source dt --save --global

对于那些使用 TypeScript 版本 2.0 + 的用户,您可以使用 npm 通过执行以下行来获取它

npm install --save @types/electron

这里是 typescript 文档的快速参考

http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html

如果您使用的打字稿版本低于 2,您也可以使用其他人已经帮助认为的打字