Skip to content

tr2-harada/typescript-definitions

 
 

Repository files navigation

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

About

Convert the Electron API JSON file to electron.d.ts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 80.9%
  • JavaScript 19.0%
  • Shell 0.1%