Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/GoodNotes/ts-interface-generator
Export JSII Compatible Interface from public NPM packages
https://github.com/GoodNotes/ts-interface-generator
cdk jsii projen-managed ts-morph
Last synced: 3 months ago
JSON representation
Export JSII Compatible Interface from public NPM packages
- Host: GitHub
- URL: https://github.com/GoodNotes/ts-interface-generator
- Owner: GoodNotes
- License: apache-2.0
- Created: 2023-09-05T11:54:27.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-17T00:16:31.000Z (3 months ago)
- Last Synced: 2024-08-17T02:32:05.045Z (3 months ago)
- Topics: cdk, jsii, projen-managed, ts-morph
- Language: TypeScript
- Homepage:
- Size: 595 KB
- Stars: 1
- Watchers: 21
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TS Interface Generator
> Export JSII Compatible Interface from external packages
This repository is an exploration of generating JSII Compatible Interfaces for public packages on NPM.
It has only been tested with the DataDog Typescript API Client package and is not intended for production use.
## Usage
```bash
# install pj dependencies
yarn
# run the export-datadog-interfaces task
npx projen@latest export-datadog-interfaces
# confirm JSII compile works
npx projen@latest compile
```## How it works
The `export-datadog-interfaces` task uses the `ts-morph` package to parse the DataDog Typescript API Client package and generate a JSII compatible interface for a specific class within the package. It resolves imports and combines all dependencies into a single Typescript source file.
Notes:
- The DataDog API Typescript Client is autogenerated by OpenAPI generator and creates `class` objects only.
- Internal properties such as `attributeTypeMap` are filtered out.
- The `UnparsedObject` type's `_data` property is tagged as internal.## References
- [Generate RunTypes from TS](https://gist.github.com/skurfuerst/a07ab23c3e40a45f2268f7700ceeceaf)
- [Type FootPrint](https://gist.github.com/zaripych/963fa6584524e5b446b70548dbabbf65)