Documentation ¶
Overview ¶
Package typescript provides tools for generating native TypeScript types from Thema's lineage and schema abstractions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateTypes ¶
GenerateTypes generates native TypeScript types and defaults corresponding to the provided Schema.
Types ¶
type TypeConfig ¶
type TypeConfig struct { // CuetsyConfig is passed directly to cuetsy, the underlying code generator. // // If nil provided, defaults to Export: true. CuetsyConfig *cuetsy.Config // Group indicates that the type is a grouped lineage - the root schema itself // does not represent an object that is ever expected to exist independently, // but each of its top-level fields do. // // NOTE - https://github.com/grafana/thema/issues/62 is the issue for formalizing // the group concept. Fixing that issue will obviate this field. Once fixed, // this field will be ignored, deprecated, and eventually removed. Group bool // RootName specifies the name to use for the type representing the root of the // schema. If empty, this defaults to titlecasing of the lineage name. // // No-op if Group is true. RootName string // RootAsType controls whether the root schema is generated as a TypeScript // interface type (false) or alias type (true). // // No-op if Group is true. RootAsType bool }
TypeConfig governs the behavior of GenerateTypes.
Click to show internal directories.
Click to hide internal directories.