strictcli v0.39.0 /typescript/src/types
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

TS typescript
export type ScalarSchema = "str" | "bool" | "int" | "float"

The four primitive type schemas supported by strictcli flags and args.

#ElemSchema

TS typescript
export type ElemSchema = "str" | "int" | "float"

Element schemas for list items and dict values -- bool is deliberately excluded.

#ListSchema

TS typescript
export type ListSchema = `list[$

Schema string for list-typed flags, parameterized by the element type.

#DictSchema

TS typescript
export type DictSchema = `dict[str,$

Schema string for dict-typed flags (keys are always str), parameterized by the value type.

#Schema

TS typescript
export type Schema = ScalarSchema | ListSchema | DictSchema

Union of all valid schema strings: scalar, list, or dict.

#Carrier

TS typescript
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

TS typescript
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

TS typescript
export type HandlerResult = number | undefined | Outcome

Strict result contract: a handler returns a number, undefined, or outcome(...).

#HandlerReturn

TS typescript
export type HandlerReturn = HandlerResult | void
Search