Targets · TypeScript · Keywords

Keywords

How each of Program's keywords is rendered into TypeScript.

Contents

How a Program becomes TypeScript, in parts. Start with the introduction, then follow each part into the rendered output and the runtime it links against.

Program keywords in TypeScript

Each keyword renders as it does in JavaScript, with Program's types written out. The declarations gain annotations and generics; the reactive keywords are the same runtime calls, typed.

KeywordRendered TypeScript
MODULEA nested namespace: export namespace Ui.Button.Integer { … }.
TYPEA record becomes class Point { constructor(public x: number, public y: number) {} }; a union becomes a discriminated union type plus one constructor per option.
FUNCTIONfunction Name(…): ReactiveValue<T> { … return … }.
NATIVEA function whose body is the ts row, or the js row reused (valid TypeScript).
INPUTA typed parameter; a BINDING input is read and written.
HOLEA typed trailing callback parameter.
LETconst name: ReactiveValue<T> = …;.
STATEconst name = Reactive.State<T>(value);.
REVERSEA write-back whose closing SET is Reactive.Set(state, value).
WITHModule.With(Name, Replacement, () => { … }).

See JavaScript keywords for the per-keyword detail and the modifiers; TypeScript differs only in the annotations carried alongside.