Skip to content

feat: bump TypeScript to 5.x and target ES2022#741

Draft
nelson-parente wants to merge 2 commits intodapr:mainfrom
nelson-parente:feat/typescript-5-es2022
Draft

feat: bump TypeScript to 5.x and target ES2022#741
nelson-parente wants to merge 2 commits intodapr:mainfrom
nelson-parente:feat/typescript-5-es2022

Conversation

@nelson-parente
Copy link
Copy Markdown

Summary

  • Bump TypeScript from ^4.5.5 to ^5.7.0
  • Update tsconfig target from ES2020 to ES2022
  • Upgrade Jest (^27^29), ts-jest (^27^29), and type definitions to match
  • Update @types/node to ^22.0.0 (matches Node 22 LTS used in CI)
  • Add engines field requiring Node >=18.0.0
  • Clean up tsconfig.json (remove commented-out options from TS 4.x era)

Motivation

The SDK's TypeScript and Jest versions are significantly behind. TypeScript 5.x has been stable since March 2023 and brings important improvements:

  • satisfies operator for type-safe configuration objects
  • Improved type inference and narrowing
  • Decorator metadata support
  • const type parameters

ES2022 target enables native:

  • Error.cause for error chaining
  • Array.at() for safe indexing
  • Object.hasOwn() as a safe hasOwnProperty replacement
  • Top-level await

Test plan

  • Run npm install to verify dependency resolution
  • Run npm run build to verify TypeScript 5.x compilation
  • Run npm run test:unit:all to verify Jest 29 compatibility
  • Run npm run lint to verify ESLint still works with TS 5.x parser
  • Verify no runtime regressions in E2E tests

Modernize the build toolchain:

- TypeScript: ^4.5.5 → ^5.7.0 (enables satisfies operator, improved
  type inference, decorator metadata, const type parameters)
- tsconfig target: ES2020 → ES2022 (native Error.cause, top-level
  await, Array.at(), Object.hasOwn(), RegExp /d flag)
- Jest: ^27.2.0 → ^29.7.0 (current LTS, better ESM support)
- ts-jest: ^27.0.5 → ^29.2.0 (compatible with Jest 29 + TS 5.x)
- @types/jest: ^27.0.1 → ^29.5.0
- @types/node: ^16.9.1 → ^22.0.0 (match Node 22 LTS used in CI)
- Add engines field requiring Node >=18.0.0
- Clean up tsconfig.json (remove commented-out options)
- Add explicit ts-jest transform config for Jest 29 compatibility

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d1bf38a) to head (f0e0e46).
⚠️ Report is 34 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #741   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines            6         6           
  Branches         1         1           
=========================================
  Hits             6         6           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- Upgrade @typescript-eslint/eslint-plugin and parser from ^5.1.0 to
  ^7.0.0 (v5 only supports up to TS 5.3, incompatible with TS 5.7)
- Upgrade eslint from ^8.1.0 to ^8.57.0 (required by @typescript-eslint v7)
- Remove redundant preset: "ts-jest" from jest.config.js (the explicit
  transform block already configures ts-jest 29; having both is a
  maintenance hazard)
- Regenerate package-lock.json to match package.json version bumps
  (lockfile was stale, resolving old Jest 27 and TS 4.x versions)

Resolved versions: typescript 5.9.3, jest 29.7.0, ts-jest 29.4.6,
@typescript-eslint/parser 7.18.0

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
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