/** * emit-straightline-typed-typescript.ts — TS typed 直線 emitter(bc#46 / Layer B2, oracle)。 * * typed-codegen.md §4.3/§4.4 の TS 具体化。可搬型記法(`outType`/`outputType`, B0/bc#44)から * TS interface/型注釈を **導出**し、生成 TS がその型で `tsc` clean になる typed 経路を足す。既存の * straight-line(`typescript-straightline`)と併存する additive な第3モード(言語識別子 * `typescript-typed`)。 * * ── oracle 位置づけ(TS は型消去)─────────────────────────────────────────────── * **TS は型消去のため runtime の脱box は無い。生成モジュールの RUNTIME 挙動は straight-line と * 完全に同一**(値・発行 op 列・Failure code)。runtime を担うのは下記 (2) の straight-line 本体 * (`bind`/`bindAsync`)だけであり、これは `typescript-straightline` と **byte-identical**。よって * 「typed 生成 ≡ runBehavior ≡ golden」は straight-line の conformance がそのまま担保する。typed 層の * 役割は「`outType` から型付き interface を導出 → 生成 TS が `tsc` で型検査を通る + 導出した型が * `outType` と構造一致する(interface field 集合 == outType obj field)」ことを権威づける検証用 * oracle である。raw→typed の実 perf 脱box(monomorphized marshaller)は go/rust の materialization * (#47/#48)+ graphddb 側 #60 の責務であって bc の TS 側ではない(bc の handler は Value を返す * mock ゆえ、bc 側の「typed」は typed materialization + typed field access + 観測等価 まで)。 * * ── 生成物の構成 ──────────────────────────────────────────────────────────────── * 1. **型宣言**: 型プラン(`typed.ts` の language-neutral 導出)の named obj 型を TS interface で * emit(決定的順・同形 dedup)。scalar/opt/arr は inline 型注釈。 * 2. **runtime 本体**: straight-line と **byte 単位で同一**の component 関数(`emitStraightlineModule` * の TS dialect をそのまま流用)+`bind`/`bindAsync`。runtime 等価は構造上自明。 * 3. **typed view(tsc 検証の実体)**: `outType`/`outputType` を持つ component ごとに typed view 関数 * `typedView_(scope): ` を emit する。各 typed node(componentRef の * `outType`)を **導出 interface に materialize**(typed ローカル)し、`ref` を **typed field * access**(`t_["f"]`)で綴じ、output を component の `outputType` 型として返す。この関数は * straight-line 本体の生値(scope)を **導出型へ materialize してから** typed に組み直す * (runtime は straight-line と同値 — `as` は型消去 no-op、field access は同じ値を返す)。tsc は * この関数を型検査し、interface field 集合が `outType` obj field と食い違えば・ref path が * interface に無い field を辿れば **fail する**(構造 pin・非空虚)。 * * ── 後方互換 ──────────────────────────────────────────────────────────────────── * `outType`/`outputType` が IR のどこにも無い場合、typed 層は emit されず、出力は * `typescript-straightline` と **byte-identical**(後方互換 pin)。 */ import type { EmitterPlugin } from "./core.js"; import { TS_SCOPE, TS_MAP_SCOPE } from "./emit-shared-typescript.js"; import { type TypedMaterializer } from "./typed.js"; export declare const tsTypedMaterializer: TypedMaterializer; /** * typescriptTypedEmitter — 言語識別子 `typescript-typed` の emitter plugin(bc#46 B2, oracle)。 * straight-line(`typescript-straightline`)+ typed 層。`outType` 無し IR は straight-line と * byte-identical(後方互換)。 */ export declare const typescriptTypedEmitter: EmitterPlugin; export { TS_SCOPE, TS_MAP_SCOPE }; //# sourceMappingURL=emit-straightline-typed-typescript.d.ts.map