This directory contains scripts for automatically generating TypeScript types from JSG RTTI.
# Generates types to `../bazel-bin/types/api.d.ts`
$ bazel build //types:types
When developing generator scripts with an IDE, you'll need to install dependencies yourself for integrated type checking and completions to work.
# Generates JSG RTTI Cap’n Proto JavaScript/TypeScript files
$ bazel build //src/workerd/jsg:rtti_capnp_js
# Install dependencies (note pnpm is required by https://github.com/aspect-build/rules_js)
$ pnpm install
# Generates types to `../bazel-bin/types/api.d.ts`
$ bazel build //types:types
# Run tests
$ bazel test //types:all
src/generator
: generating TypeScript AST nodes from JSG RTTIsrc/transforms
: post-processing TypeScript AST transformssrc/index.ts
: main entrypointsrc/{print,program}.ts
: helpers for printing nodes and creating programsdefines
: additional TypeScript-only definitions that don't correspond toworkerd
runtime APIs, appended to the end of outputs
bazel build //types:types && rm -rf types/generated-snapshot && cp -r bazel-bin/types/definitions types/generated-snapshot