typescript-wasm-bindgen

WIP, many aspects not yet implemented.

Import typescript definitions directly in your wasm rust app.

Usage

```typescript // src/index.ts

export function test(): void { console.log("test"); } ```

build.rs

```rust // build.rs

use std::path::PathBuf;

use typescriptwasmbindgen::buildtypescriptwasm_binding;

fn main() { buildtypescriptwasmbinding(&PathBuf::from("./ts/testfunction.ts"), "test").unwrap(); } ```

```rust // lib.rs

use typescriptwasmbindgen::importtypescriptwasmbinding; use wasmbindgen::prelude::{wasm_bindgen, JsValue};

importtypescriptwasmbinding!("testfunction"); ```

proc_macro

```rust // wasm/src/lib.rs

use typescriptwasmbindgen::typescript; use wasmbindgen::prelude::wasmbindgen;

typescript!("../src/index.ts", "index");

// typescript! macro expands like following: // // #[wasm_bindgen(module = "index")] // extern "C" { // fn test(); // } ```

Examples

simple