https://github.com/stellar/dts-xdr
A library for generating TypeScript declarations (.d.ts) for js-xdr auto-generated files.
https://github.com/stellar/dts-xdr
stellar typescript xdr
Last synced: 11 months ago
JSON representation
A library for generating TypeScript declarations (.d.ts) for js-xdr auto-generated files.
- Host: GitHub
- URL: https://github.com/stellar/dts-xdr
- Owner: stellar
- License: apache-2.0
- Created: 2020-05-04T18:53:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-08-01T21:55:36.000Z (almost 2 years ago)
- Last Synced: 2025-06-18T15:51:58.219Z (about 1 year ago)
- Topics: stellar, typescript, xdr
- Language: JavaScript
- Homepage: https://github.com/stellar/dts-xdr
- Size: 59.6 KB
- Stars: 3
- Watchers: 22
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dts-xdr
[](https://circleci.com/gh/stellar/dts-xdr)
`dts-xdr` is a library for generating `TypeScript` declarations file (`.d.ts`) for [js-xdr](https://github.com/stellar/js-xdr) auto-generated files.
This library uses [jscodeshift](https://github.com/facebook/jscodeshift) to generate the definitions, follow the steps below to generate definitions.
## Setup
```sh
git clone https://github.com/stellar/dts-xdr.git
cd dts-xdr
yarn install
```
## Usage
You can use this library in two mode:
### Source replacement
The first one is using inline replacement which is the default mode when you call `jscodeshift`. The following will replace the given file with the generated code:
> npx jscodeshift -t src/transform.js sample/stellar-xdr_generated.js
After you run the command above, `sample/stellar-xdr_generated.js` will have the type definitions.
### Output mode
The second mode is specifying an output file, this mode won't change the source file. The following command will generate a new file called `stellar-xdr_generated.d.ts` with the `TypeScript` declarations:
> OUT=stellar-xdr_generated.d.ts npx jscodeshift -t src/transform.js sample/stellar-xdr_generated.js