https://github.com/electron/typescript-definitions
Convert the Electron API JSON file to electron.d.ts
https://github.com/electron/typescript-definitions
Last synced: 7 months ago
JSON representation
Convert the Electron API JSON file to electron.d.ts
- Host: GitHub
- URL: https://github.com/electron/typescript-definitions
- Owner: electron
- License: mit
- Created: 2016-09-24T08:42:28.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2025-05-01T21:04:22.000Z (8 months ago)
- Last Synced: 2025-05-06T16:13:50.034Z (8 months ago)
- Language: TypeScript
- Homepage:
- Size: 1.33 MB
- Stars: 129
- Watchers: 42
- Forks: 37
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Electron TypeScript Definitions
This module uses Electron's [JSON API documentation](https://github.com/electron/docs-parser) to produce a TypeScript definition file for the Electron API.
[](https://github.com/electron/typescript-definitions/actions/workflows/test.yml)
[](https://npmjs.org/package/@electron/typescript-definitions)
## Installation
```sh
npm install @electron/typescript-definitions --save
```
## CLI Usage
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
## 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
```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
```
## License
MIT