Skip to content

[no-Jira] Migrate to TypeScript 6#1792

Merged
canac merged 3 commits into
mainfrom
typescript-6
May 21, 2026
Merged

[no-Jira] Migrate to TypeScript 6#1792
canac merged 3 commits into
mainfrom
typescript-6

Conversation

@canac
Copy link
Copy Markdown
Contributor

@canac canac commented May 21, 2026

Description

Upgrade to TypeScript 6.0

Testing

  • Test that CSV upload and profile image upload still works

Checklist:

  • I have given my PR a title with the format "MPDX-(JIRA#) (summary sentence max 80 chars)"
  • I have applied the appropriate labels (Add the label "Preview" to automatically create a preview environment)
  • I have run the Claude Code /pr-review command locally and fixed any relevant suggestions
  • I have requested a review from another person on the project
  • I have tested my changes in preview or in staging
  • I have cleaned up my commit history

@canac canac self-assigned this May 21, 2026
@canac canac added the Preview Environment Add this label to create an Amplify Preview label May 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Preview branch generated at https://typescript-6.d3dytjb8adxkk5.amplifyapp.com

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

Bundle sizes [mpdx-react]

Compared against 1d25db1

No significant changes found

@canac canac force-pushed the typescript-6 branch 2 times, most recently from 2665662 to 094a21d Compare May 21, 2026 13:33
Copy link
Copy Markdown
Contributor Author

@canac canac left a comment

Choose a reason for hiding this comment

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

Multi-Agent Code Review

Verdict: APPROVED WITH SUGGESTIONS — no blockers, mechanical TS 5.6 → 6.0 bump. 1 Important + 4 Medium/Suggestion findings posted as inline comments.

Risk Assessment

  • Score: 10/10 (capped) — CRITICAL
  • Driven by typescript compiler-version blast radius across the whole repo, not by semantic risk in the diffs themselves. The actual changes are minimal and mechanical.
  • Gate merge on a green whole-repo yarn lint:ts + yarn test CI run, plus a manual smoke test of the two upload paths (CSV import + avatar upload) given the new Uint8Array(...) wrap.

Agents Run

Security, Architecture, Testing, UX, Standards, Financial Reporting (Data Integrity skipped — no schema/migration/Apollo cache/mutation/pagination changes).

Key Findings

  1. [Important 7.0] Root cause of every String(t(...)) wrap is stale i18next@21.9.2 / react-i18next@11.18.6. Newer versions return string by default, or augment via interface CustomTypeOptions { returnNull: false }. Eliminates the churn and de-risks the ~73 other unwrapped aria-label={t(...)} sites that compile today only because looser MUI prop typings tolerate the wider return type. Follow-up ticket recommended — not blocking.

  2. [Medium 6.5] Inconsistent fix style: ExpectedMonthlyTotalReportTable.tsx hoists const label = t(...) while the other 7 files inline String(t(...)). Pick one. Flagged by 4 agents (Architecture, Testing, UX, Standards).

  3. [Medium 6.0] New tsconfig.json types: ["node", "jest", "@testing-library/jest-dom"] narrowing is load-bearing on a transitive /// <reference types="google.maps" /> from @googlemaps/js-api-loader. Add an explicit reference in app.d.ts so a future dep upgrade can't silently drop ambient types.

  4. [Medium 5.0] Selective application — only ~7 of ~80 aria-label={t(...)} sites were wrapped (rest compile via looser MUI prop typings). Confirm yarn lint:ts passes whole-repo, not just changed files, before merging.

  5. [Suggestion 4.0] @types/testing-library__jest-dom is now redundant — the runtime @testing-library/jest-dom package ships its own types (and is referenced explicitly in the new types array). Remove from devDependencies.

  6. [Suggestion 4.0] No tests cover the two upload endpoints (pre-existing, excluded by jest coverage policy). new Uint8Array(Buffer) wrap is byte-identical at runtime, but smoke-test both upload paths before merge.

What's Clean

  • Security: No findings. NextAuthOptions['providers'] swap is type-equivalent to Provider[]. new Uint8Array(buffer) copies bytes 1:1 (no risk of reading past buffer). typescript correctly placed in devDependencies. No NextAuth callback / CSP / env-var / redirect changes.
  • Financial Reporting: No calculation, aggregation, currency, or date logic touched.
  • Standards Checklist: All applicable items PASS. No new any, no @ts-ignore, no debug output, no commented-out code, no new Date().
  • Architecture positives: moduleResolution: "bundler" is the correct choice for Next 15 + TS 6. Removing baseUrl while adding explicit paths is the right move. declare module '*.css' confirmed needed (2 real CSS imports in _app.page.tsx).

Dependency Impact

Global: tsconfig.json, app.d.ts, package.json, .yarn/sdks/typescript/package.json. No breaking runtime changes.


Findings on Related Files (Not in Diff Hunk)

The following finding is on a file in this PR but on a line outside the diff hunk, so it cannot be posted as a line-anchored comment:

[Suggestion 4.0] package.json:116@types/testing-library__jest-dom is now redundant. The runtime @testing-library/jest-dom package ships its own types and is referenced explicitly in the new tsconfig.json types array. Remove this DefinitelyTyped package from devDependencies: yarn remove @types/testing-library__jest-dom. Informational — not blocking.

Comment thread package.json
Comment thread app.d.ts
export = value;
}

declare module '*.css';
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[Medium] With the new `tsconfig.json` `types: ["node", "jest", "@testing-library/jest-dom"]` narrowing, ambient `google.maps` types resolve only because `@googlemaps/js-api-loader` carries a transitive `/// `. Any future upgrade of that package that drops the reference will silently lose those ambient types. Recommend adding an explicit reference here so the chain isn't load-bearing on a transitive dep's internals:
/// <reference types="google.maps" />
declare module '*.graphql' { ... }
declare module '*.css';
declare module '*.svg';

Comment thread pages/api/uploads/csv-upload.page.ts Outdated
@canac canac requested a review from wjames111 May 21, 2026 13:39
@canac
Copy link
Copy Markdown
Contributor Author

canac commented May 21, 2026

@wjames111 This is not urgent at all. But I remembered I had this working in a branch a few weeks ago, so I might as well push it up. This should take care of all the breaking changes so that when TypeScript 7.0 comes out (which is supposed to be ~10x faster 🚀 ) it will be an easy upgrade.

Copy link
Copy Markdown
Contributor

@wjames111 wjames111 left a comment

Choose a reason for hiding this comment

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

Looks great, looking forward to the upgrade! Claude mentioned this as well, "the String(t(...)) workaround papered over a typing problem that's better solved with one module-augmentation block in app.d.ts" if this is possible to do a in a module wouldn't it be better just to do it there?

Comment thread pages/api/uploads/csv-upload.page.ts Outdated
Comment thread app.d.ts
@canac canac merged commit bdb41fd into main May 21, 2026
24 checks passed
@canac canac deleted the typescript-6 branch May 21, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Preview Environment Add this label to create an Amplify Preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants