Parent #844; overall parity #66. Follows source commit 4341646, which evaluates exact numeric expressions within one enum declaration but does not transfer member values across separate declaration owners.
Repro with two .d.ts files in declare module "pkg" / namespace Nested:
- First:
export const enum Mode { One = 1 } - Second:
export const enum Mode { Two = One << 1 }(also reproduced withMode.One << 1) - Consumer:
const good: 2 = Nested.Mode.Two; const wrong: 1 = Nested.Mode.Two;
TypeScript 5.9.3 accepts the good assignment and reports only TS2322 at the wrong assignment, in either file order. Current Home reports TS2474 at the second declaration and misses the consumer TS2322. A forward reference across separate fragments also succeeds in TypeScript. The same forward reference within one declaration reports TS2474, so permitting all forward identifiers would be unsound.
Implementation must preserve source/declaration ownership while resolving cross-fragment enum dependencies, including qualified and unqualified member references, without making same-declaration forward references legal. Cycles, duplicate names, unsupported expressions, imported-module identity and virtual sections need explicit acceptance/rejection controls. Do not erase to any, reorder declarations as a workaround, suppress diagnostics or publish a partial enum route.
Acceptance: exact TypeScript diagnostic sets and values for positive/negative, normal/reversed file order, same-file distinct fragments, same-declaration forward rejection, qualified/unqualified references, cycles and duplicates; unfiltered Program/checker/driver/CLI/entrypoint gates under the 3,840 MB guard. Report native Bun limitations separately; no performance claim without benchmark qualification.