Skip to content

TypeScript type definitions and Bun runtime support for raphtory-js #2547

@vyasraos

Description

@vyasraos

Summary

As raphtory-js (WASM bindings) matures, it would be great to have first-class TypeScript and Bun support:

  1. TypeScript type definitions — Ship .d.ts types alongside the WASM/JS bindings so TypeScript users get autocomplete, type checking, and documentation out of the box. wasm-bindgen can generate these via --typescript.

  2. Bun runtime compatibility — Verify that the WASM module loads and runs correctly under Bun, which has native WASM support and is increasingly used as a Node alternative. This includes:

    • WebAssembly.instantiate / WebAssembly.compileStreaming compatibility
    • ESM import of the generated .wasm module
    • Any Node-specific APIs (e.g. fs, path) used in the JS glue code should have Bun equivalents or be abstracted
  3. npm publishing — Related to Publish raphtory-js to npm #919 (closed), the package doesn't appear to be on npm yet. Publishing with TS types and documenting Bun compatibility would significantly lower the barrier for JS/TS users.

Motivation

TypeScript is the dominant language for JS-ecosystem projects, and Bun is gaining traction as a fast, batteries-included runtime. Supporting both would make Raphtory accessible to a much wider audience beyond Python and Rust.

Suggested approach

  • Use wasm-bindgen --typescript to auto-generate .d.ts files
  • Add a types field to package.json
  • Add Bun to the test matrix (CI) alongside Node
  • Publish to npm with proper exports map for ESM/CJS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions