Skip to content

Upgrade Webpack to 5.111.0 and TypeScript to 6.0.3 - #22901

Merged
sergiou87 merged 14 commits into
developmentfrom
upgrade-webpack
Oct 8, 2026
Merged

sergiou87 merged 14 commits into
developmentfrom
upgrade-webpack

Conversation

@sergiou87

@sergiou87 sergiou87 commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Description

Upgrade Webpack from 5.104.1 to 5.111.0 and TypeScript from 5.8.2 to 6.0.3, the latest stable versions verified when this work was done. The TypeScript upgrade covers the application, build scripts, syntax-highlighting worker, custom ESLint rules, and all three TypeScript-based native modules.

The migration preserves existing compiler strictness and enabled lint checks rather than suppressing diagnostics to make the upgrade pass.

This should serve as a step before migrating to TypeScript 7 (whenever we get proper ESLint support for it, or if we decide to go with the "TS6 bridge" approach).

Dependency and build changes

  • Upgrade Webpack and refresh its dependency graph. Keep direct and transitive Webpack references on one version so middleware typings use the same Compiler type. No Webpack configuration changes were needed.
  • Upgrade TypeScript to 6.0.3 in the root package and in desktop-trampoline, desktop-notifications, and windows-argv-parser, updating all corresponding lockfiles.
  • Upgrade ts-node to 10.9.2 and @types/lodash to 4.17.25.
  • Upgrade the TypeScript ESLint parser, plugin, ESTree package, and utilities to 8.70.0. Replace the retired experimental-utils dependency with utils.
  • Upgrade ESLint to 8.57.1 and eslint-plugin-react to 7.37.5 for compatibility with the new parser.
  • Upgrade Dexie from 3.2.7 to 4.4.6 because the older declarations use a namespace syntax rejected by TypeScript 6.

Compiler and application changes

  • Replace deprecated Node-style module resolution with bundler for Webpack-compiled code, nodenext for build scripts, and node16 for native modules and custom ESLint rules.
  • Declare source roots explicitly for the application, scripts, worker, and native modules; explicitly select Node ambient types where needed. Native modules retain CommonJS output.
  • Replace imports from private Copilot SDK implementation paths with types derived from the public RPC API. Import directly exported billing types from the SDK's public entry point.
  • Normalize shared DDS image buffers to an ordinary ArrayBuffer before parsing and rendering. Add tests for both ordinary and shared buffers.
  • Replace boxed primitive/object types and broad Function types with primitive/object types and concrete callback signatures. Represent the crash window's empty props with Record<string, never> and remove its old empty-interface suppression.
  • Remove unused catch bindings without changing the existing catch bodies, logging, or fallback behavior.

Lint rules, tests, and documentation

  • Update custom rules for the current TypeScript ESTree AST and utility types, including optional-chain handling in the strongly typed IPC rule.
  • Enable strict checking for custom rule implementations and include their actual test directory in the compiler project.
  • Rename the existing custom-rule suites from *.test.js to *-test.mjs so the repository's Node.js test runner discovers them. Keep those tests included in ESLint and Prettier checks.
  • Add regression coverage for optional IPC calls/property access and for the empty-interface rule configuration.
  • Document the compiler upgrade workflow, module-resolution choices, and lint-rule compatibility mappings.

Decisions and trade-offs

Preserve checks instead of hiding errors

No new skipLibCheck, deprecation-suppression options, or type-error suppressions were added. Existing strict compiler options remain unchanged; custom ESLint rules now also explicitly use strict mode. Their pre-existing skipLibCheck setting is unchanged.

The old and new effective lint configurations were compared to retain previously enabled checks:

  • no-empty-object-type uses allowInterfaces: never and allowObjectTypes: always. This preserves the old no-empty-interface checks without newly banning {} types that were permitted while ban-types was disabled.
  • no-extra-non-null-assertion remains explicitly enabled, and ESLint's core no-loss-of-precision replaces the removed TypeScript extension rule.
  • Disabled no-var-requires maps to disabled no-require-imports, preserving the existing CommonJS policy. Forcing asynchronous imports would change startup behavior and Electron renderer callbacks that must load modules synchronously.
  • Newly recommended wrapper-object and unsafe-function checks remain enabled; their findings were fixed in source.

Match module resolution to the execution environment

Using one resolution mode everywhere would not accurately model both Webpack bundles and Node-executed scripts. The separate modes respect package exports while retaining the native modules' CommonJS format. Explicit roots avoid changes caused by compiler root-directory defaults.

Respecting SDK exports exposed the private type imports. Deriving types from the public RPC methods preserves the exact metadata Desktop consumes without copying interfaces or loosening them with casts. These derived types still intentionally follow the SDK's RPC API as it evolves.

Keep the tooling migration bounded

ESLint stays on the compatible 8.57.1 release rather than combining this upgrade with an ESLint major-version/flat-config migration. The React plugin update resolves parser-related false positives without disabling React prop validation. The larger lockfile diff includes the upgraded tools' transitive dependencies and Webpack's upstream minifier dependency changes.

Dexie is the notable runtime dependency upgrade. Updating the maintained library was preferred over disabling declaration checking or carrying a local dependency patch. Existing database migration tests and the complete application test suite pass, but this major-version change warrants particular review.

The DDS conversion keeps the ordinary ArrayBuffer path allocation-free. Shared buffers incur a copy so parsing and rendering use an ordinary-buffer snapshot; both paths have regression tests.

Validation

Validated locally on macOS:

  • All seven TypeScript compiler projects: application/tests, scripts, highlighter, custom ESLint rules, and the three native modules.
  • Development and production Webpack compilation.
  • Full unit/UI suite: 1,739 passed, 1 skipped.
  • Build/release script suite: 19 passed.
  • Custom lint-rule/configuration tests: 6 passed.
  • Native-module TypeScript builds and trampoline tests: 11 passed.
  • yarn lint:fix, yarn lint, and whitespace checks.

The environment sets safe.bareRepository=explicit, which initially prevented four Git fixture tests from passing. The successful full-suite runs used safe.bareRepository=all only in the test process environment; persistent Git settings were not changed.

Packaged-app/E2E runs and Windows-native binary execution were not performed locally. CI and cross-platform validation remain to be reviewed before marking this draft ready.

Also deployed 3.6.7-test2 (proving it's able to make production builds for both platforms) and smoke-tested those builds (Copilot included, given we're changing how one of its dependencies -koffi- is bundled).

Screenshots

Not applicable: no intentional visual changes.

Commit structure

  1. 92685500a9 - Upgrade Webpack to 5.111.0.
  2. 1e288ac10f - Upgrade native-module TypeScript builds to 6.0.3.
  3. ed42bf6280 - Prepare application types and lint usage.
  4. 3541f7246c - Upgrade Dexie for TypeScript 6 declaration compatibility.
  5. 913cbcb40a - Upgrade compiler/lint tooling, custom-rule tests, and documentation.

Release notes

Notes: no-notes

sergiou87 and others added 5 commits September 18, 2026 10:58
Update webpack to 5.111.0 and refresh its dependency resolution.
Use Node16 module resolution, explicit Node ambient types, and stable source roots without changing strict compiler checks. Refresh all three native-module lockfiles.

Co-authored-by: Copilot <[email protected]>
Derive Copilot RPC types through the public SDK API instead of private export paths. Normalize shared DDS buffers and cover both buffer variants in tests. Tighten empty props, wrapper, and callback types and remove unused catch bindings without changing error handling.

Co-authored-by: Copilot <[email protected]>
Dexie 3 uses a declaration syntax rejected by TypeScript 6. Use the maintained release instead of skipping library checks. Verified database schema migration tests and the complete application test suite.

Co-authored-by: Copilot <[email protected]>
Migrate bundled and Node projects to supported module resolution with explicit source roots, preserving all existing strict compiler checks. Update ts-node, TypeScript ESLint, React lint support, and Lodash declarations.

Preserve prior enabled lint rules, migrate custom rule AST handling, and restore custom-rule test discovery with regression coverage. Keep renamed suites covered by ESLint and Prettier. Document the compiler upgrade verification workflow.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings September 18, 2026 10:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The desktop-notifications root directory change relocates its package output, causing current macOS and Windows CI builds to fail.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: None

What changed in this PR

Upgrades GitHub Desktop’s TypeScript, Webpack, ESLint, and Dexie toolchains while adapting compiler configuration, typings, custom rules, and tests.

Changes:

  • Updates compiler/build dependencies and module-resolution modes.
  • Migrates custom ESLint rules and Copilot SDK types to public APIs.
  • Adds SharedArrayBuffer DDS coverage and refreshes runtime dependencies.
File Description
.eslintrc.yml Migrates renamed TypeScript ESLint rules.
package.json Updates build, lint, and compiler dependencies.
yarn.lock Refreshes the root dependency graph.
tsconfig.json Uses bundler resolution and an explicit root.
docs/​contributing/​upgrading-dependencies.md Documents TypeScript upgrade practices.
script/​tsconfig.json Uses NodeNext resolution for scripts.
script/​test-setup.ts Removes an unused catch binding.
script/​run.ts Removes an unused catch binding.
script/​pr-api.ts Removes unused catch bindings.
script/​draft-release/​index.ts Removes an unused catch binding.
eslint-rules/​tsconfig.json Enables strict checking for rules and tests.
eslint-rules/​README.md Documents updated rule tooling.
eslint-rules/​no-loosely-typed-webcontents-ipc.js Supports the current optional-chain AST.
eslint-rules/​react-no-unbound-dispatcher-props.js Updates rule typings.
eslint-rules/​react-proper-lifecycle-methods.js Updates lifecycle-rule AST handling.
eslint-rules/​react-readonly-props-and-state.js Updates rule typings.
eslint-rules/​tests/​config-test.mjs Tests empty-interface rule behavior.
eslint-rules/​tests/​insecure-random-test.mjs Migrates the rule test to ESM.
eslint-rules/​tests/​no-loosely-typed-webcontents-ipc-test.mjs Adds optional IPC coverage.
eslint-rules/​tests/​react-no-unbound-dispatcher-props-test.mjs Migrates the rule test to ESM.
eslint-rules/​tests/​react-proper-lifecycle-methods-test.mjs Migrates lifecycle tests to ESM.
eslint-rules/​tests/​react-readonly-props-and-state-test.mjs Migrates readonly tests to ESM.
vendor/​desktop-notifications/​package.json Upgrades TypeScript.
vendor/​desktop-notifications/​tsconfig.json Updates native-module compiler settings.
vendor/​desktop-notifications/​yarn.lock Locks TypeScript 6.0.3.
vendor/​desktop-trampoline/​package.json Upgrades TypeScript.
vendor/​desktop-trampoline/​tsconfig.json Updates native-module compiler settings.
vendor/​desktop-trampoline/​yarn.lock Locks TypeScript 6.0.3.
vendor/​windows-argv-parser/​package.json Upgrades TypeScript.
vendor/​windows-argv-parser/​tsconfig.json Updates native-module compiler settings.
vendor/​windows-argv-parser/​yarn.lock Locks TypeScript 6.0.3.
app/​package.json Upgrades Dexie.
app/​yarn.lock Refreshes the Dexie dependency.
app/​src/​highlighter/​tsconfig.json Uses bundler resolution for the worker.
app/​src/​crash/​crash-app.tsx Replaces an empty props interface.
app/​src/​lib/​api.ts Modernizes object types and catch clauses.
app/​src/​lib/​directory-exists.ts Removes an unused catch binding.
app/​src/​lib/​get-main-guid.ts Removes an unused catch binding.
app/​src/​lib/​git/​description.ts Removes an unused catch binding.
app/​src/​lib/​git/​reflog.ts Replaces a boxed string type.
app/​src/​lib/​git/​status.ts Removes an unused catch binding.
app/​src/​lib/​git/​var.ts Removes an unused catch binding.
app/​src/​lib/​globals.d.ts Narrows an exit-listener signature.
app/​src/​lib/​http.ts Uses primitive object types.
app/​src/​lib/​local-storage.ts Removes unused catch bindings.
app/​src/​lib/​markdown-filters/​emoji-filter.ts Removes an unused catch binding.
app/​src/​lib/​source-map-support.ts Removes unused catch bindings.
app/​src/​lib/​ssh/​ssh.ts Removes an unused catch binding.
app/​src/​lib/​stores/​app-store.ts Uses public Copilot types.
app/​src/​lib/​stores/​copilot-store.ts Uses public SDK billing and model types.
app/​src/​lib/​copilot/​types.ts Derives types from the public RPC API.
app/​src/​lib/​copilot/​conflict-resolution-model.ts Uses the shared public model type.
app/​src/​main-process/​app-window.ts Removes an unused catch binding.
app/​src/​main-process/​exception-reporting.ts Removes an unused catch binding.
app/​src/​main-process/​log.ts Removes an unused catch binding.
app/​src/​main-process/​main.ts Removes an unused catch binding.
app/​src/​ui/​diff/​image-diffs/​dds-converter.ts Normalizes shared image buffers.
app/​src/​ui/​lib/​app-proxy.ts Removes an unused catch binding.
app/​src/​ui/​lib/​avatar.tsx Removes an unused catch binding.
app/​src/​ui/​lib/​copilot-model-picker.tsx Uses shared Copilot types.
app/​src/​ui/​lib/​install-cli.ts Removes an unused catch binding.
app/​src/​ui/​lib/​throttled-scheduler.ts Narrows the callback type.
app/​src/​ui/​index.tsx Removes an unused catch binding.
app/​src/​ui/​preferences/​copilot-settings-dialog.tsx Uses shared Copilot types.
app/​src/​ui/​preferences/​copilot-user-settings.tsx Uses shared Copilot types.
app/​src/​ui/​preferences/​copilot.tsx Uses shared Copilot types.
app/​test/​unit/​copilot-conflict-resolution-model-test.ts Uses shared Copilot types.
app/​test/​unit/​dds-converter-test.ts Covers ordinary and shared buffers.
app/​test/​unit/​stores/​copilot-store-test.ts Uses shared Copilot types.
app/​test/​unit/​ui/​copilot-preferences-test.tsx Uses shared Copilot types.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

sergiou87 and others added 2 commits September 18, 2026 12:47
Restore lib as the notifications source root so fresh builds emit the published dist entry points. Add compiler-output contract tests for all native TypeScript packages so stale artifacts cannot mask layout regressions, and document this validation requirement.

Co-authored-by: Copilot <[email protected]>
Filter other platforms' optional Koffi packages from the renderer bundle and resolve the target eagerly so a missing native package fails the build. This prevents cross-compilation installs from emitting multiple different binaries as koffi.node.

Add multi-platform Webpack regression builds that verify the emitted binary contents, a missing-target check, and packaging documentation. Validate macOS x64 and arm64 production compilation with both native packages installed.

Co-authored-by: Copilot <[email protected]>
Comment thread app/webpack.common.ts Dismissed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The major Dexie upgrade and cross-platform native bundling changes require successful CI and packaged-app validation.

Review effort: Balanced
Findings: None

"compilerOptions": {
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "bundler",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our old value was deprecated and wouldn't be supported on TS7

Awaited<
ReturnType<CopilotClient['rpc']['account']['getQuota']>
>['quotaSnapshots'][string]
>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach is required due to the new moduleResolution: 'bundler' 🤷‍♂️

Comment thread app/package.json
"desktop-notifications": "file:../vendor/desktop-notifications",
"desktop-trampoline": "file:../vendor/desktop-trampoline",
"dexie": "^3.2.3",
"dexie": "^4.4.6",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two options:

  • Override types of Dexie v3 to make it compatible with TS6
  • Upgrade to Dexie v4

Chose to upgrade, test manually, and since I didn't notice any regressions… 🤞

Comment thread app/webpack.common.ts
Comment on lines +72 to +76
getKoffiWebpackConfig(
path.resolve(__dirname, 'node_modules'),
process.platform,
getDistArchitecture()
),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Copilot (and I have verified to the extent of my knowledge): this is something that comes from Copilot SDK, and it's required due to the Webpack upgrade because of webpack/webpack#20497

@sergiou87
sergiou87 marked this pull request as ready for review September 18, 2026 14:48
@sergiou87
sergiou87 requested a review from a team as a code owner September 18, 2026 14:48
@williammartin
williammartin removed their request for review September 22, 2026 13:11

@niik niik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic work @sergiou87, a type safer future awaits

Comment thread app/src/lib/git/reflog.ts

const lines = result.stdout.split('\n')
const names = new Set<string>()
const excludedNames = new Set<String>()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@sergiou87
sergiou87 merged commit a12d657 into development Oct 8, 2026
9 checks passed
@sergiou87
sergiou87 deleted the upgrade-webpack branch October 8, 2026 09:39
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.

4 participants