Skip to content

Quickstart

Install the emitter with the TypeSpec versions Typra currently validates:

Terminal window
npm install --save-dev @typra/emitter `
@typespec/compiler@1.10.0 `
@typespec/json-schema@1.10.0

Add Typra to tspconfig.yaml:

emit:
- "@typra/emitter"
options:
"@typra/emitter":
emitter-output-dir: "{cwd}/generated"
root-object: "MyProject.ApiRoot"
root-namespace: "MyProject"
emit-targets:
- type: TypeScript
output-dir: "generated/typescript"
test-dir: "generated/typescript/tests"
import-path: "../index"
- type: Go
output-dir: "generated/go"
test-dir: "generated/go/tests"
package-name: "myproject"

Import the emitter library from your TypeSpec entry point:

import "@typra/emitter";
namespace MyProject;

Compile:

Terminal window
npx tsp compile ./path/to/main.tsp --config ./tspconfig.yaml

Verify generated metadata:

Terminal window
npx typra-verify --baseline ./baseline --current ./generated

typra-verify compares committed .typra-generated metadata against current generated metadata and prints deterministic review summaries for exports, protocols, files, package identity, toolchain, protected paths, schema evolution, stale cleanup dry-runs, hydration seams, and breaking-change classification.