typescript

package
v0.2.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package typescript generates TypeScript type declarations from a resolved model.

docs/design/schema-backends.md has the mapping and the reasons for it. What it emits describes JSON on the wire rather than runtime objects: interfaces and type aliases, no classes, and no code. That is why a set is an array, a map is a Record, and every primitive TypeScript has no JSON form for is a string. An enum whose variants carry fields is a discriminated union on a `kind` field holding the variant's name, which a `discriminant` directive renames.

Index

Constants

View Source
const Name = "typescript"

Name is what this backend is called, in a target block and as tdl-gen-typescript on PATH.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct{}

Backend implements plugin.Backend.

func (Backend) Describe

func (Backend) Describe() plugin.Description

func (Backend) Generate

func (Backend) Generate(_ context.Context, req *plugin.Request) (*plugin.Response, error)

Generate returns one .ts file holding every declaration the model owns.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL