Convert the Electron API JSON file to electron.d.ts
Перейти к файлу
Erick Zhao 09a945f5c9
chore: remove releases and upgrades from CODEOWNERS
2023-06-12 11:12:59 -07:00
.circleci build: use CircleCI cimg/node image (#225) 2023-02-07 14:14:43 -08:00
.github chore: remove releases and upgrades from CODEOWNERS 2023-06-12 11:12:59 -07:00
.husky build: update deps to clean up yarn audit (#212) 2022-12-05 14:54:24 -08:00
.vscode fix: dynamic params might be collections (#193) 2021-08-25 14:03:33 -07:00
base fix: add `node:original-fs` (#230) 2023-05-23 13:10:24 +02:00
src fix: wrap comments with words > 80 chars correctly (#232) 2023-06-12 11:08:28 -07:00
test fix: wrap comments with words > 80 chars correctly (#232) 2023-06-12 11:08:28 -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 chore: update references to previous repo name (#219) 2023-02-01 16:58:55 -08:00
LICENSE chore: add LICENSE file to match package.json (#216) 2023-01-31 13:03:36 -08:00
README.md chore: update references to previous repo name (#219) 2023-02-01 16:58:55 -08:00
package.json feat: add new Event support for extensible params (#218) 2023-02-01 16:59:04 -08:00
tsconfig.json fix: move docs-parser to dev-dep 2020-04-02 10:39:57 -07:00
yarn.lock build(deps): bump yaml from 2.1.3 to 2.2.2 (#228) 2023-04-26 10:01:40 +02:00

README.md

Electron TypeScript Definitions

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

CircleCI npm version

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