Convert the Electron API JSON file to electron.d.ts
Перейти к файлу
Samuel Attard a96d0cf753
chore: remove unused index.js file
2021-08-25 13:57:48 -07:00
.circleci build: run prettier in CI 2021-08-25 13:50:03 -07:00
base fix: only export value types for things that are actually exported 2021-04-17 19:21:18 -07:00
src chore: run prettier 2021-08-25 13:49:30 -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: migrate master->main 2021-08-25 13:49:12 -07:00
CONTRIBUTING.md build: migrate master->main 2021-08-25 13:49:12 -07:00
README.md build: migrate master->main 2021-08-25 13:49:12 -07:00
package.json fix: only export value types for things that are actually exported 2021-04-17 19:21:18 -07:00
tsconfig.json fix: move docs-parser to dev-dep 2020-04-02 10:39:57 -07:00
yarn.lock build(deps): bump path-parse from 1.0.6 to 1.0.7 (#192) 2021-08-10 18:49:37 -05: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