Skip to content

Latest commit

 

History

History
45 lines (30 loc) · 2.36 KB

File metadata and controls

45 lines (30 loc) · 2.36 KB

typescript-as-data

A specification for a statically evaluable subset of TypeScript. It comes with a reference implementation and a conformance suite.

The subset is the part of TypeScript whose value is fixed by its source: literals, constants, and symbolic references. A tool can reduce it to data without running it. Most configuration languages get this property by inventing a language. This specification carves a fragment out of an existing one and defines the edge: source outside the subset falls back to real execution, and the two paths must agree.

Status

Every part of the mechanism has a normative draft under spec/. One identifier vocabulary covers them (S-* for shape rules, F-* for fold rules). A decision-point inventory of 112 rows cites those rules and is gated in CI. A reference implementation covers J1 to J3 and revival; packages/reference/CAVEATS.md says what it does not. chant is cross-checked against it from the published package, on the fixtures and on chant's whole example corpus. Fixture coverage is 100 of 127 rules; spec/fixtures/UNCOVERED.md lists the rest with a reason each and may only shrink.

Layout

The repository is three things and a site.

Path Holds
spec/ The normative specification
spec/fixtures/ Conformance fixtures, one directory per rule
packages/reference The reference implementation (@intentius/tsad-reference)
packages/conformance The adapter interface, fixture format, runner, and the chant adapter
docs/ The published site (Hugo, on choudoufu's layout); the normative pages are generated from spec/
evaluators/rust/ tsad-eval, the data-host profile in Rust on oxc, with no JavaScript runtime (#86)

Relationship to chant

chant is a production implementation of this subset and its origin. It is not the reference implementation; the conformance suite tests it, and its example corpus is what the suite measures against.

Development

Node 24 and npm.

npm install
npm run typecheck
npm test
npm run lint:prose
TSAD_CHANT_REPO=../chant npm run corpus   # the corpus cross-check (#25); needs a chant checkout with its lexicons generated

npm run docs        # docs dev server (needs hugo)
npm run docs:build  # static build to docs/public, as CI runs it

License

Licensed under Apache-2.0; see LICENSE.