chore: upgrade TypeScript from 5.6.3 to 6.0.3#504
Conversation
41e17bb to
f86de50
Compare
There was a problem hiding this comment.
Pull request overview
Upgrades the repo to TypeScript 6.0.3 (and newer Node typings) and updates TypeScript/ESM module resolution settings, with follow-up type fixes across route handlers and utilities to keep the build passing under stricter typing.
Changes:
- Upgrade dev deps:
typescript5.6.3 → 6.0.3 and@types/node22.9.0 → 24.12.2 - Switch TS module settings to
module: nodenext+moduleResolution: nodenext - Apply targeted TS-compat fixes: safer
catchhandling/narrowing, workertypeof import()tweaks, and minor typing adjustments in utilities
Reviewed changes
Copilot reviewed 15 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
package.json |
Bumps TypeScript and Node type definitions. |
pnpm-lock.yaml |
Locks updated dependency graph for the upgraded toolchain. |
tsconfig.json |
Moves compilation/module resolution to NodeNext. |
utils/view-engine.ts |
Adjusts Express view engine typing/callback handling for TS 6. |
utils/disk-cache.ts |
Narrows catch error typing when ignoring ENOENT. |
utils/background-task-queue.ts |
TS 6 class property initialization fix; relaxes worker module input typing. |
routes/xref/update.ts |
Updates worker module type query import to include .ts under NodeNext. |
routes/caniuse/update.ts |
Updates worker module type query import to include .ts under NodeNext. |
routes/xref/lib/store.ts |
Narrows catch type and checks ENOENT in a TS-safe way. |
routes/xref/lib/search.ts |
Replaces @ts-ignore with @ts-expect-error and documents intent. |
routes/w3c/group.ts |
Reworks catch blocks to safely derive status/message from unknown errors. |
routes/respec/builds/update.ts |
Uses HTTPError narrowing for status/message in catch. |
routes/docs/update.ts |
Uses HTTPError narrowing for status/message in catch. |
routes/github/files.ts |
Avoids assuming caught values have .message; normalizes to string. |
routes/github/commits.ts |
Avoids assuming caught values have .message; normalizes to string. |
routes/github/contributors.ts |
Safely checks error type before inspecting .message. |
routes/caniuse/feature.ts |
Avoids assuming caught values have .message; normalizes to string. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 17 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f86de50 to
ede7124
Compare
ede7124 to
5d4a3b0
Compare
- Update typescript to ^6.0.3 and @types/node to ^24.12.2 - Change tsconfig module/moduleResolution from esnext/node to nodenext - Fix catch clause variables typed as unknown (stricter in TS 6) - Replace @ts-ignore with @ts-expect-error - Fix definite assignment assertion for Logger.result - Fix view-engine type compatibility with express
5d4a3b0 to
18649e2
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 17 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 17 changed files in this pull request and generated 3 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 17 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot you review this and any issues that come ip |
|
@copilot Fix failing test on ci |
|
@copilot try again? |
Fixed in 977c771. The failure was a cache poisoning bug in The fix adds |
| input: unknown; | ||
| timings: Record<string, Date> = {}; | ||
| result: { type: "success" | "failure"; value: unknown }; | ||
| result!: { type: "success" | "failure"; value: unknown }; |
There was a problem hiding this comment.
The ! is TypeScript's definite assignment assertion. It tells the compiler this property will be assigned before it's read, even though the constructor doesn't assign it. Without it, TS6 with strictPropertyInitialization (implied by strict) reports an error because result has no initializer and isn't set in the constructor. It's safe here because setResult() (line 99) is always called before result is read.
- Re-throw HTTPError directly in group.ts catch block instead of double-wrapping it - Revert cache key change in search.ts (behavior change, not a TS upgrade fix; should be a separate PR)
|
@copilot Can you confirm all your feedback has been addressed? Please resolve the threads that have been addressed and fix anything outstanding. |
All feedback has been addressed. Here's a summary of what's in the current branch:
CI is passing (commit |
* chore: upgrade TypeScript from 5.6.3 to 6.0.3 - Update typescript to ^6.0.3 and @types/node to ^24.12.2 - Change tsconfig module/moduleResolution from esnext/node to nodenext - Fix catch clause variables typed as unknown (stricter in TS 6) - Replace @ts-ignore with @ts-expect-error - Fix definite assignment assertion for Logger.result - Fix view-engine type compatibility with express * Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * refactor: type engine directly as EngineCallback, remove async and cast Agent-Logs-Url: https://github.com/speced/respec-web-services/sessions/50c73c28-bbb9-43db-8a58-d5c85ae17fd3 * refactor: simplify engine body, let TS infer params from EngineCallback type Agent-Logs-Url: https://github.com/speced/respec-web-services/sessions/50c73c28-bbb9-43db-8a58-d5c85ae17fd3 * fix: resolve TaskModule TS errors, extract getErrnoCode helper Agent-Logs-Url: https://github.com/speced/respec-web-services/sessions/a465b3f6-aa1e-4a52-9998-11d12704f748 * test: add coverage for getErrnoCode utility Agent-Logs-Url: https://github.com/speced/respec-web-services/sessions/a465b3f6-aa1e-4a52-9998-11d12704f748 * fix(xref): include options.all in search cache key to prevent cache poisoning Agent-Logs-Url: https://github.com/speced/respec-web-services/sessions/9ff1c977-d8d7-467c-937f-9353541e3b87 * fix: address Sid's review feedback - Re-throw HTTPError directly in group.ts catch block instead of double-wrapping it - Revert cache key change in search.ts (behavior change, not a TS upgrade fix; should be a separate PR) --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Summary
Major TypeScript upgrade from 5.6.3 to 6.0.3.
Changes
module/moduleResolutionchanged fromesnext/nodetonodenext/nodenextCode fixes (12 files)
unknowntyping — narrowed withinstanceofin 8 route handlers.tsextension fortypeof import()in 2 update workers@ts-ignore→@ts-expect-errorin xref searchTaskModuletype relaxed for worker input typesSupersedes Dependabot PR #486.