Skip to content

Migrate the whole codebase to TypeScript - #25

Merged
AshishB2000 merged 3 commits into
mainfrom
feat/typescript-bootstrap
Jul 29, 2026
Merged

AshishB2000 merged 3 commits into
mainfrom
feat/typescript-bootstrap

Conversation

@AshishB2000

Copy link
Copy Markdown
Owner

Moves the entire app from plain JS to TypeScript ahead of the BI expansion, using in-place sibling emit (foo.ts compiles to a gitignored foo.js next to it) so require paths, <script> tags, CSP, and electron-builder packaging never change.

Scope

  • 62 .ts sources + 6 .d.ts β€” main.ts, src/, preload/, scripts/**, and all renderer windows. No .js sources remain (runtime .js is compiled output, gitignored wholesale).
  • Toolchain: typescript + @types/node; build:ts runs via postinstall/prestart/pretest/predist so every entry point compiles first. CI type-checks with tsc.

Strictness

  • Main world (tsconfig.main.json, NodeNext CommonJS) is fully strict and compiles clean.
  • Renderer (tsconfig.renderer.json) relaxes strict/noImplicitAny/strictNullChecks for the legacy global-scope <script> layer. Cross-file hub symbols share automatically as script globals; per-window globals.d.ts declare only genuinely external globals (preload bridges, Chart/Leaflet/pdfmake/pptx/docx vendors, baked geo payloads). Documented as tighten-later.

Verified

  • npm run build:ts strict-clean (0 errors), npm test passes, npm start boots (hotkey registers, CLI detection runs), npm run dist:mac builds with the afterSign seal intact and no .ts in the asar.

Notes

  • Flagged a pre-existing bug in globals.d.ts: showPermissionPanel() is called in a click handler but defined nowhere (identical in the original JS β€” throws at runtime). Declared ambient to preserve exact behavior; fix separately.
  • A human smoke-test of the hub UI (capture β†’ chart β†’ export) is still worth doing β€” automated gates all pass but don't click through the renderer.

Convert all ~59 remaining JS modules to TypeScript (in-place sibling
emit): main.ts, src/**, preload/**, scripts/**, and the renderer windows.
Runtime .js is now compiled output and gitignored wholesale; the .ts
files are the sources.

Main world (tsconfig.main.json) is fully strict and compiles clean.
The renderer (tsconfig.renderer.json) relaxes strict/noImplicitAny/
strictNullChecks for the legacy global-scope <script> layer, typed via
per-window globals.d.ts declaring only external globals (window bridges,
Chart/Leaflet/pdfmake vendors, geo payloads) β€” cross-file hub symbols
share automatically as script globals. Flag one pre-existing bug
(showPermissionPanel, called but never defined) in globals.d.ts.

CI type-checks via tsc; postinstall/prestart/pretest/predist compile
first; .ts excluded from the packaged app. Verified: tsc clean, npm test
passes, app boots, dist:mac builds.
README and QUICKSTART said "no build step β€” plain JS loads directly",
which is no longer true after the migration. Note that npm start compiles
TypeScript (build:ts) first, and add a build:ts row to the QUICKSTART
scripts table.
AGENTS.md (the cross-tool agent-instructions filename read by Codex,
Cursor, etc.) existed only as a stale, untracked local copy predating the
TypeScript migration. Commit it as an exact copy of the current CLAUDE.md
so every agent tool gets the same up-to-date project instructions.
@AshishB2000
AshishB2000 merged commit 200c650 into main Jul 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant