Convert the Electron API JSON file to electron.d.ts
Перейти к файлу
Samuel Attard e844013010
fix: expose shared structs as well and fix Remote interface
2020-04-02 15:10:53 -07:00
.circleci build: use node LTS 2019-04-23 13:49:58 -07:00
base fix: expose shared structs as well and fix Remote interface 2020-04-02 15:10:53 -07:00
src fix: expose shared structs as well and fix Remote interface 2020-04-02 15:10:53 -07:00
test refactor: use the new @electron/docs-parser module and rewrite in TS (#139) 2019-05-01 13:00:49 -07:00
.gitignore refactor: use the new @electron/docs-parser module and rewrite in TS (#139) 2019-05-01 13:00:49 -07:00
.npmignore fix: avoid leaking secrets (#93) 2018-02-12 11:29:16 -08:00
.prettierrc.json refactor: use the new @electron/docs-parser module and rewrite in TS (#139) 2019-05-01 13:00:49 -07:00
.releaserc.json build: switch to CFA v2 2019-12-13 11:14:03 -05:00
CONTRIBUTING.md chore: remove the cli.js development utility (#151) 2019-07-26 13:30:47 -07:00
README.md refactor: use the new @electron/docs-parser module and rewrite in TS (#139) 2019-05-01 13:00:49 -07:00
index.js Update files to fix output linting issues 2017-03-25 14:30:41 +11:00
package.json fix: move docs-parser to dev-dep 2020-04-02 10:39:57 -07:00
tsconfig.json fix: move docs-parser to dev-dep 2020-04-02 10:39:57 -07:00
yarn.lock fix: move docs-parser to dev-dep 2020-04-02 10:39:57 -07:00

README.md

Electron TypeScript Definitions Build Status

This module uses Electron's JSON API documentation to produce a TypeScript definition file for the Electron API.

Installation

npm install @electron/typescript-definitions --save

CLI Usage

To generate the definitions

electron-typescript-definitions --api=path/to/electron/api.json --out-dir=path/to/out/dir

Any warnings during the generation can normally be ignored unless it actually throws an error

Programmatic Usage

The module exports a function that parses a given API JSON object and returns an array of lines to create the definition file

const { generateDefinitions } = require('electron-typescript-definitions')
const apiPath = './vendor/electron/docs/api.json'

const definitionLines = generateDefinitions({ electronApi: require(apiPath) })
// definitionLines will be an strin representation of the definition file

License

MIT