Skip to content

Migrate electron frontend to TypeScript (#1032)#1034

Merged
Tim020 merged 2 commits into
devfrom
feature/electron-typescript-migration
May 13, 2026
Merged

Migrate electron frontend to TypeScript (#1032)#1034
Tim020 merged 2 commits into
devfrom
feature/electron-typescript-migration

Conversation

@Tim020
Copy link
Copy Markdown
Contributor

@Tim020 Tim020 commented May 13, 2026

Summary

  • Converts all 5 Electron source files (~694 lines) from JavaScript to TypeScript, matching the conventions established in the recent client migration (Migrate front end to TypeScript #906)
  • Adds tsc compilation step outputting to dist/ — required because the Electron main process needs real .js files (unlike the Vite-built client which uses noEmit)
  • Adds run-typecheck-electron CI job to nodelint.yml alongside the existing lint job

Key changes

  • main.jsmain.ts: typed ConnectionManager variable; local win pattern in createWindow() removes the unused module-level mainWindow ref
  • preload.cjspreload.cts: .cts extension signals CommonJS within an ESM project; tsc compiles it to dist/preload.cjs (Electron sandbox requires CJS preloads)
  • services/ConnectionManager.ts: Connection, ConnectionInput, ConnectionStoreSchema interfaces; Store<ConnectionStoreSchema> for type-safe CRUD
  • services/MDNSDiscovery.ts: DiscoveredServer / DiscoveredServerWithVersion interfaces; Service type from bonjour-service
  • services/VersionChecker.ts: VersionCheckResult interface; NodeJS.ErrnoException for typed error code checks
  • eslint.config.mjs: replaced JS config blocks with @typescript-eslint parser/plugin blocks for .ts/.cts; no-undef: off for TS files (TypeScript handles this natively)
  • tsconfig.json: NodeNext modules + ES2022 lib (no DOM); same strictness flags as client (strictNullChecks, strictFunctionTypes)

Test plan

  • npm run typecheck — zero errors
  • npm run ci-lint — zero errors (Prettier + ESLint)
  • npx tscdist/main.js, dist/preload.cjs, dist/services/*.js all produced correctly
  • npm run dev — app starts and loads DigiScript UI

🤖 Generated with Claude Code

Converts all 5 source files to TypeScript using the same conventions as
the recent client migration: strict null checks, NodeNext modules, and
@typescript-eslint v8. Adds a tsc compilation step (output to dist/)
since the Electron main process needs real .js files unlike the
Vite-built client.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added github GitHub actions related issue or pull request client Pull requests changing front end code xlarge-diff labels May 13, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 13, 2026

Client Test Results

128 tests   128 ✅  0s ⏱️
  6 suites    0 💤
  1 files      0 ❌

Results for commit 259e6e2.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 13, 2026

Python Test Results

  1 files    1 suites   1m 27s ⏱️
603 tests 603 ✅ 0 💤 0 ❌
608 runs  608 ✅ 0 💤 0 ❌

Results for commit 259e6e2.

♻️ This comment has been updated with latest results.

Regenerated lockfile from scratch to include transitive deps
(encoding, iconv-lite) introduced by the TypeScript devDependencies.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Tim020 Tim020 linked an issue May 13, 2026 that may be closed by this pull request
@sonarqubecloud
Copy link
Copy Markdown

@Tim020 Tim020 enabled auto-merge (squash) May 13, 2026 18:47
@Tim020 Tim020 disabled auto-merge May 13, 2026 18:47
@Tim020 Tim020 enabled auto-merge (squash) May 13, 2026 18:47
@Tim020 Tim020 merged commit 60f74a1 into dev May 13, 2026
27 checks passed
@Tim020 Tim020 deleted the feature/electron-typescript-migration branch May 13, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client Pull requests changing front end code github GitHub actions related issue or pull request xlarge-diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate electron front end to TypeScript

1 participant