如何为 Electron 安装打字稿定义?
How do I install typescript definitions for Electron?
我有两个问题:
- 我应该安装哪些定义?
typings search electron
returns 相当多的结果。
如何安装它们? typings install dt~github-electron --global --save
给我一个错误:
Attempted to compile "github-electron" as an external module, but it
looks like a global module. You'll need to enable the global option to
continue.
需要将 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,您也可以使用其他人已经帮助认为的打字
我有两个问题:
- 我应该安装哪些定义?
typings search electron
returns 相当多的结果。 如何安装它们?
typings install dt~github-electron --global --save
给我一个错误:Attempted to compile "github-electron" as an external module, but it looks like a global module. You'll need to enable the global option to continue.
需要将 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,您也可以使用其他人已经帮助认为的打字