Expand description
Strip-only TypeScript → JavaScript for Bynk’s first-class JS artefact (the in-browser track, slice 1 — ADR 0137).
bynkc emits TypeScript. A JS artefact is emit-then-strip: the same emitter
output with type annotations erased and nothing else changed. Because the
emitter is strip-only (ADR 0136 — every emitted .ts is erasable by pure
type-stripping), the transform here is total and lossless for runtime
behaviour: it never has to lower a type-directed construct (parameter
property, enum, namespace), only delete type syntax.
The engine is [oxc] — a pure-Rust TS parser, type-erasing transform, and
codegen — so neither bynkc --emit js nor the in-browser compile path has any
Node/tsc dependency, and the crate compiles to wasm32 for the playground.
The transform is configured for pure type-stripping, matching Node’s
stripTypeScriptTypes (the slice-0 strip oracle): only_remove_type_imports
keeps every value import even when unused, eliding only import type and
type specifiers — TypeScript’s import-elision-by-usage is deliberately off,
so stripping is a syntactic erase, not a semantics-aware rewrite.
Structs§
- Strip
Error - A failure to strip TypeScript to JavaScript. For input produced by the Bynk
emitter this should never occur — the emitter only emits valid, strip-only
TypeScript (ADR 0136) — so a
StripErrorindicates an emitter or toolchain bug rather than user error.
Functions§
- strip_
project_ to_ js - Rewrite a compiled
ProjectOutputfrom TypeScript into a JavaScript artefact (the in-browser track’s first-class JS output — ADR 0137). The emitter always produces TypeScript; a JS artefact is that same output with types stripped, which is total because the emitter is strip-only (ADR 0136). - strip_
types - Strip TypeScript types from
source, returning equivalent JavaScript.