Skip to content

m-bock/purescript-ts-bridge

Repository files navigation

purescript-ts-bridge

example workflow

Call your PureScript code from TypeScript.

Documentation

Installation

spago install ts-bridge

Demo

Some TypeScript - PureScript ping pong ...

Demo

Features

  • Fully customizable via a user defined type class pattern
  • Many default implementations to pick from (Primitives, Records, Variants, ...)
  • Opaque types (implemented as branded types in TypeScript)
  • Easily accessible Newtypes
  • Module resolution
  • Polymorphic types optimized for best type inference in TS
  • Tried and tested in production

How it works

Via type classes a set of types are defined that you'd like to support to export to TypeScript. The library creates an extra CLI entry point to your app, which generates types for given values of those types. They get written to the file system in the form of TypeScript type declaration (.d.ts) files.

Similar Projects

  • purescript-tsd-gen This project follows a different approach for type generation. It extracts TypeScript types from the PureScript CST. As such the process is more automated but less customizable.

Support

If you find a bug or have a feature idea feel free to make a PR or file an issue.

Buy Me a Coffee at ko-fi.com

About

Call your PureScript code from TypeScript.

Resources

License

Stars

Watchers

Forks

Packages

No packages published