strict-script strict-script

Packages

@strict-script/std

What compiled strict-script programs import as they run. It has no dependency and never imports the compiler.

A program in TypeScript that calls a compiled module reads its types from here:

import type { JsonError, Option, ParseError, Result, Thrown } from '@strict-script/std';

const read = parseInvoice(text);            // Result<Invoice, JsonError | ParseError>
if (read.ok) read.value; else read.error;   // narrowed by `ok`

An Option is { some: true, value } | { some: false } and a Result is { ok: true, value } | { ok: false, error }: plain data, with no method. some, none, ok and err make them. They are described in The standard library.

FileWhat it holds
src/types.tsOption, Result, Thrown, ParseError, JsonError
src/options.ts, src/collections.ts, src/numbers.tsWhat the methods of the language become: mapOption, mapGet, sortedBy, toNumber…
src/check.tsThe checks a type becomes, to read a value of unknown type against it
src/unsafe/boundary.tsThe boundary: where exceptions are caught and rejections read
src/unsafe/door.tsThe door of a compiled module: what reads each argument of an exported function, and what gives its result to the outside
src/unsafe/stop.tsWhat stops the program (panic), and what is remembered of it

Apart from the types and their four makers, the exports are what the compiler calls in the JavaScript it writes; their names may change with it.

This package is not written in strict-script and is not under strict-ts: it is what is taken on trust at run time, and it is tested.

Esc

    Type a word of the language, a rule, a command: mut, extern, match-not-covered.