https://github.com/ted537/tsembind
Generate typescript bindings for Embind projects
https://github.com/ted537/tsembind
embind emscripten wasm
Last synced: 9 months ago
JSON representation
Generate typescript bindings for Embind projects
- Host: GitHub
- URL: https://github.com/ted537/tsembind
- Owner: ted537
- Created: 2021-05-12T17:15:38.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-04-05T23:38:56.000Z (about 3 years ago)
- Last Synced: 2025-07-06T18:18:51.221Z (10 months ago)
- Topics: embind, emscripten, wasm
- Language: TypeScript
- Homepage:
- Size: 113 KB
- Stars: 26
- Watchers: 4
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Typescript for Emscripten (TSEMBIND)
Generate `.d.ts` files using your existing Emscripten projects.
Re-compiling is not necessary!

Installation:
```
npm i -g tsembind
```
Usage:
```
tsembind my-embind-lib.js
```
## How it works
Embind registers functions,classes, etc. at runtime,
by calling JS functions like `__embind_register_function()` from WASM.
These functions can be replaced by replacing `WebAssembly.instantiate()`
with a wrapper.
Similarly, `__embind_register_function()` can be wrapped
to compile the type information.
## Limitations
Embind only knows the order and type of parameters at runtime. As such, declarations will refer to parameters as `arg0`, `arg1`, etc
## Compatibility
Known to work with the following EMSDK config.
```
releases-upstream-c2ac7520fad29a7937ed60ab6a95b08eb374c7ba-64bit
node-14.15.5-64bit
```
## Development
Install EMSDK, make sure everything is on the path, and then run `npm build`
To debug, run `npm link` followed by `tsembind lib/examplelib.js`
To run the automatic tests, run `npm test`