Convert the Electron API JSON file to electron.d.ts
Перейти к файлу
dependabot[bot] c419cea8f2
build(deps): bump cross-spawn from 7.0.3 to 7.0.6 (#288)
Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.6.
- [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md)
- [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6)

---
updated-dependencies:
- dependency-name: cross-spawn
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-18 18:29:04 -05:00
.github ci: timeout release job after 1 hour (#285) 2024-11-14 14:05:02 -08:00
.husky feat: convert to ESM + update all dependencies (#277) 2024-09-24 17:07:17 -07:00
.vscode fix: dynamic params might be collections (#193) 2021-08-25 14:03:33 -07:00
base fix: remove File.path (#281) 2024-11-08 15:21:00 -05:00
src fix: add null to primitives (#284) 2024-11-13 12:41:15 +01:00
test feat: allow custom types with inner types (#278) 2024-10-20 17:11:12 -04:00
.gitattributes feat: convert to ESM + update all dependencies (#277) 2024-09-24 17:07:17 -07:00
.gitignore
.prettierrc.json
.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 ci: switch to GHA (#283) 2024-11-08 13:29:50 -08:00
jest.config.js feat: convert to ESM + update all dependencies (#277) 2024-09-24 17:07:17 -07:00
package.json ci: switch to GHA (#283) 2024-11-08 13:29:50 -08:00
tsconfig.json feat: convert to ESM + update all dependencies (#277) 2024-09-24 17:07:17 -07:00
yarn.lock build(deps): bump cross-spawn from 7.0.3 to 7.0.6 (#288) 2024-11-18 18:29:04 -05:00

README.md

Electron TypeScript Definitions

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

Test 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

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