ReviewOS

home-lang/home

fix(ts): preserve merged ambient members through namespace re-exports

#944
Closed glennmichael123 opened this 8 days ago ·
8 days ago

Parent #66; related to completed #943, whose acceptance covered named, renamed, star and chained ambient reexports but not export-star-as namespace aliases. On current origin/main c57880c, pkg declares Nested.Box as a class in one ambient declaration fragment and augments Nested.Box.extra: 2 in another. Barrel declares module barrel with export * as API from pkg. A consumer imports API and checks API.Nested.Box constructor, readonly id: 1, and static extra: 2. Installed TypeScript 5.7.3 under strict/noEmit/skipLibCheck reports exactly TS2322 for bad id, TS2322 for bad extra, and TS2345 for bad constructor argument; valid reads are silent. Rebuilt Home CLI under identical explicit-file options exits 0 with no diagnostics, silently accepting all three negatives. Both commands ran serially under HOME_RUN_MAX_MB=3840. Acceptance: retain exact source-owned value and type surfaces through namespace reexports, including merged class/namespace members, constructor and instance types; preserve module alias identity, ordinary value/type restrictions, unsupported-schema rejection and collision behavior. Add Program/streaming/CLI regression, compare codes/messages/locations with TypeScript, run unfiltered relevant gates. No any erasure, diagnostic suppression, fixture changes or broad parity claim.

8 days ago

Pushed 7d1b127 to origin/main. export * as API from "pkg" now resolves one ambient module identity across declaration fragments and forwards the completed value/type routes after all fragments are collected, rather than projecting only the first fragment. Added Program normal/streaming tests with both source orders, a tsc_main adapter regression with both import orders, and an unsupported-schema withholding check. TypeScript 5.7.3 and rebuilt Home CLI produce identical four diagnostics (TS2322 x3, TS2345) on the class/namespace/type fixture, including messages and locations. Guarded gates: ts_program 393/393, tsc_main 68/68, ts_cli 89/89; zig fmt --check and git diff --check clean. Keeping this issue open: chained module-namespace aliases, type-only/value restrictions, and collision cases still need explicit differential coverage before its full acceptance can be claimed. Pinned Bun WebKit is absent, so no native Bun-parity claim.

8 days ago

Follow-up pushed directly to main: 992794895. TypeScript 5.7.3 reports TS2322, TS2322, TS2345 for a second ambient namespace barrel (pkg -> barrel.API -> chain.Public); the rebuilt Home CLI now matches all three messages and locations. The deferred forwarder now processes module-alias dependencies after direct routes are collected and withholds failed/cyclic or unsupported upstream projections instead of publishing partial subtrees. Program normal/streaming and add-order regression added; tsc_main adapter regression added. Guarded gates: ts_program 394/394, tsc_main 69/69; zig fmt --check and git diff --check clean. #944 remains open for explicit type-only/value restriction and collision differentials before full acceptance.

8 days ago

Pushed b5ea012 to origin/main for the type-only restriction case. TypeScript 5.7.3 and rebuilt Home CLI now report identical TS1362 diagnostics at both runtime uses of API from export type * as API from "pkg"; the nested API.Nested.Box type remains valid. Program normal/streaming and tsc_main adapter regressions added. Guarded gates: ts_checker 4682/4682, ts_program 395/395, tsc_main 70/70; formatting and diff checks clean. #944 remains open for collision differentials and any remaining alias-identity edge cases.

8 days ago

Pushed 4abc72f directly to main. Explicit ambient export * as API now retains its source module's typeof import("pkg") display identity when competing with a star-imported API, in either export order. Rebuilt Home CLI matches TypeScript 5.7.3 exactly on all six collision diagnostics (codes, messages, locations); a same-shaped pair of ambient modules also retains distinct typeof import("shape-a") and typeof import("shape-b") names. Added Program normal/streaming and tsc_main adapter regressions. Guarded gates: ts_program 397/397, tsc_main 71/71, ts_checker 4682/4682; formatting and diff checks clean. Keeping #944 open until remaining edge cases such as empty source modules and duplicate explicit aliases are differentially verified; no broad Bun parity claim.

8 days ago

Remaining acceptance gap confirmed with a guarded differential after 4abc72f: declare module "empty-pkg" {} plus export * as Empty from "empty-pkg"; consumer Empty.missing. TypeScript 5.7.3 emits TS2339 at line 2 col 23 with type typeof import("empty-pkg"); rebuilt Home CLI exits 0 with no diagnostic. The current deferred forwarder has no value/type routes to project for an empty source module, so the alias fact cannot supply an exact namespace object. This needs a first-class empty module namespace representation with the same soundness rules as nonempty aliases; do not paper it over with any or a fixture exception. #944 stays open.

8 days ago

Pushed 5bd5f41 to origin/main. The confirmed empty-module gap is fixed using complete source export facts: an ordinary alias to a module with no runtime exports now has an exact empty namespace value (not any), while unknown/unsupported/value-bearing sources are not projected this way. TypeScript 5.7.3 and rebuilt Home CLI match codes, messages, and locations for empty-a, empty-b, and an interface-only types-pkg; Types.Item remains valid. Added Program normal/streaming and tsc_main adapter regressions. Guarded gates: ts_program 398/398, tsc_main 72/72, ts_checker 4682/4682; zig fmt --check and git diff --check clean. #944 remains open for duplicate explicit-alias collision verification before declaring full acceptance.

8 days ago

Pushed 0b4411745 directly to main as glennmichael123 (3 files, no coauthors). Fixed duplicate explicit ambient namespace re-exports: TypeScript 5.7.3 binds the first declaration in source order, including type-only precedence; Home previously merged competing origins into ambiguity and silently accepted consumer errors. Added Program normal/streaming and CLI-adapter regressions for both declaration orders, and corrected an older origin test to assert the TypeScript-observed first type-only binding. Verified ts_program 399/399 and tsc_main 73/73; rebuilt home-tsc matches TypeScript's three TS2339 diagnostics (messages and locations) on the seven-file differential fixture. Zig formatting and diff checks pass. Checker build remains cached and unaffected. #944 stays open while the rest of its stated collision/unsupported-schema acceptance is audited; this is not a broad Bun parity claim.

8 days ago

Remaining verified #944 edge after 0b44117: duplicate export * as X aliases split across two ambient declare module "barrel" fragments. TypeScript 5.7.3 chooses the alias from the first root file; reversing root order reverses ownership. On a bounded Home CLI run, the first-order fixture (a exports onlyA, b exports onlyB, consumer reads both) exits 0 with no diagnostics, whereas TypeScript reports TS2551 for X.onlyB on typeof import("a"). This is distinct from the same-fragment collision fixed above. Root cause under investigation: Query.indexAmbientModules iterates an unordered file hash map and enqueueModule traverses all fragment owners, producing ambiguous origins. Keeping #944 open; no parity claim for this edge yet.

8 days ago

Pushed a3dcf4129 directly to main as glennmichael123 (3 files, no coauthors). Fixed the cross-file fragment collision reported above: export-origin queries now preserve Program source order instead of iterating a hash map; local declarations keep precedence over forwarded aliases, while duplicate forwarded aliases choose the first fragment. Added origin, Program normal/streaming, and CLI-adapter regressions in both file orders and with a local fragment. Verified ts_program 401/401, tsc_main 74/74; rebuilt Home CLI matches TypeScript 5.7.3 TS2551 code, message, and location in first-order, reversed-order, and local-last fixtures. All heavy runs were serial and bounded below the 3,840 MB ceiling; formatting/diff checks pass. #944 remains open for the rest of its acceptance audit; this is not a claim of complete Bun parity.

8 days ago

Closing the scoped #944 acceptance after the final cross-file fix a3dcf4129. The issue's merged class/namespace value and type surfaces, constructors/instances, chained aliases, type-only runtime restriction, empty and same-shaped module identity, star/explicit and duplicate collision precedence, and unsupported partial-route withholding all have Program coverage; normal and streaming consumers plus CLI-adapter regressions cover the positive/negative paths. TypeScript 5.7.3 versus rebuilt Home CLI differentials match diagnostic codes/messages/locations for the reported fixture and the additional collision/empty-module fixtures. Final unfiltered gates: ts_program 401/401, tsc_main 74/74, ts_cli 89/89, ts_driver 222/222; checker artifact remains cached from its earlier 4682/4682 run, with no checker-source change in these commits. Zig formatting/diff checks pass. This closes #944 only; #66 and full Bun/native/all-platform parity remain open, and the pinned Bun WebKit artifact is absent on this host.

Sign in to comment on this issue.