Automatically generated TypeScript definitions files for the Electron API
npm install @electron/typescript-definitionsThis module uses Electron's JSON API documentation to produce a TypeScript definition file for the Electron API.


``sh`
npm install @electron/typescript-definitions --save
To generate the definitions
`sh`
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
The module exports a function that parses a given API JSON object and returns
an array of lines to create the definition file
`js
import { generateDefinitions } from '@electron/typescript-definitions'
const apiPath = './vendor/electron/docs/api.json'
const definitionLines = generateDefinitions({ electronApi: loadJSON(apiPath) })
// definitionLines will be an string representation of the definition file
``
MIT