RpcElixir.Codegen (elixir_ts_rpc v0.0.2)

Copy Markdown View Source

Generates the TypeScript client from an RPC router.

generate/2 reads the router's __procedures__/0 list. Three commands run it: the :elixir_ts_rpc compiler (Mix.Tasks.Compile.ElixirTsRpc) on each compile, mix rpc.gen.ts (Mix.Tasks.Rpc.Gen.Ts) once, and mix rpc.gen.ts.watch on save. See Getting started, step 5.

Summary

Functions

Generates TypeScript source from a router module.

Functions

generate(router_mod, opts \\ [])

@spec generate(
  module(),
  keyword()
) :: String.t()

Generates TypeScript source from a router module.

Options:

  • :client_import — client package specifier, default "@elixir-ts-rpc/client".
  • :out — output file path. When set, handler source links in the JSDoc become absolute file:// URIs, clickable in an editor. Otherwise they are repo-root-relative paths.