Skip to main content

Crate bynk_strip

Crate bynk_strip 

Source
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§

StripError
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 StripError indicates an emitter or toolchain bug rather than user error.

Functions§

strip_project_to_js
Rewrite a compiled ProjectOutput from 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.