On this page
Type foundation: nominally-branded carriers pairing a phantom output type with a literal schema string, productionizing Solution 10 from a verified spike.
#typescript/src/types
#typescript/src/types
Type foundation: nominally-branded carriers pairing a phantom output type with a literal schema string, productionizing Solution 10 from a verified spike. See docs/history/_ts-port-spec.md, "Type-machinery reference".
#ScalarSchema
export type ScalarSchema = "str" | "bool" | "int" | "float"The four primitive type schemas supported by strictcli flags and args.
#ElemSchema
export type ElemSchema = "str" | "int" | "float"Element schemas for list items and dict values -- bool is deliberately excluded.
#ListSchema
export type ListSchema = `list[$Schema string for list-typed flags, parameterized by the element type.
#DictSchema
export type DictSchema = `dict[str,$Schema string for dict-typed flags (keys are always str), parameterized by the value type.
#Schema
export type Schema = ScalarSchema | ListSchema | DictSchemaUnion of all valid schema strings: scalar, list, or dict.
#Carrier
export interface Carrier<Out, S extends Schema>A carrier pairs a phantom output type with a literal schema string and the runtime parse function. The schema string and the output type are computed by one generic per constructor, so they cannot drift.
#t
export const t =Type carrier namespace. Each property (t.str, t.bool, t.int, t.float) is a scalar carrier pairing a runtime parser with a phantom output type. t.list() and t.dict() build compound carriers from a scalar element carrier.
flag("name", t.str, { help: "User name" }) flag("count", t.int, { help: "Item count" }) flag("tags", t.list(t.str), { help: "Tag list", repeatable: true, unique: true })
#HandlerResult
export type HandlerResult = number | undefined | OutcomeStrict result contract: a handler returns a number, undefined, or outcome(...).
#HandlerReturn
export type HandlerReturn = HandlerResult | void