Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/electron/typescript-definitions
Convert the Electron API JSON file to electron.d.ts
https://github.com/electron/typescript-definitions
Last synced: about 1 month 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 8 years ago)
- Default Branch: main
- Last Pushed: 2024-04-11T18:22:59.000Z (7 months ago)
- Last Synced: 2024-04-14T03:56:20.182Z (7 months ago)
- Language: TypeScript
- Homepage:
- Size: 1.05 MB
- Stars: 122
- Watchers: 43
- Forks: 39
- 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.
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/electron/typescript-definitions/tree/main.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/gh/electron/typescript-definitions/tree/main)
[![npm version](http://img.shields.io/npm/v/@electron/typescript-definitions.svg)](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 strin representation of the definition file
```## License
MIT