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).

bynk 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 bynk --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_types
Strip TypeScript types from source, returning equivalent JavaScript.
strip_types_mapped
strip_types for one emitted module, also composing the module’s Bynk-to-JavaScript source map: bynk_map is the emitter’s Bynk-to-TypeScript v3 map for the same module (None skips the map work entirely). Returns the JavaScript and, when bynk_map was given and the two maps compose, the composed v3 map as JSON (#2705).