fix(simulation): add TypeScript types for simulation pipeline + remove dead legacy fallbacks (#2414)

- Add scripts/seed-forecasts.types.d.ts with ambient interfaces for all
  simulation data structures (CandidatePacket, TheaterResult, SimulationOutcome,
  ExpandedPath, SimulationEvidence, SimulationAdjustmentDetail)
- Add // @ts-check + @param JSDoc to contradictsPremise, negatesDisruption,
  computeSimulationAdjustment, applySimulationMerge
- Add scripts/jsconfig.json to enable tsc --checkJs on seed-forecasts.mjs
- Remove dead legacy fallbacks candidatePacket?.topBucketId and
  candidatePacket?.topChannel (these fields were never at top level in
  production; the correct path is candidatePacket.marketContext.topBucketId).
  TypeScript now enforces this at write time.
- Update all test fixtures to use marketContext: { topBucketId, topChannel }
  shape, matching production CandidatePacket structure
This commit is contained in:
Elie Habib
2026-03-28 13:05:18 +04:00
committed by GitHub
parent 483da385bd
commit 4eb1d292eb
4 changed files with 249 additions and 13 deletions

15
scripts/jsconfig.json Normal file
View File

@@ -0,0 +1,15 @@
{
"compilerOptions": {
"checkJs": true,
"strict": false,
"noImplicitAny": false,
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"allowJs": true,
"maxNodeModuleJsDepth": 0,
"skipLibCheck": true
},
"include": ["seed-forecasts.mjs", "seed-forecasts.types.d.ts"],
"exclude": []
}