Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to TS 5.8 #17537

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open

chore: upgrade to TS 5.8 #17537

wants to merge 4 commits into from

Conversation

Nodonisko
Copy link
Contributor

@Nodonisko Nodonisko commented Mar 10, 2025

Description

I had to set target to ES2023 because 24 introduces some changes to Buffer typings which caused huge amount of error across mostly codebase. I don't see it as issue to have it set for ES2023.

There was few minor changes necessary but it should not break anything.

Also updated ESlint because it's kind of dependant on TS version.

Related Issue

Resolve

Screenshots:

@Nodonisko Nodonisko added monorepo Task about monorepo management no-project This label is used to specify that PR doesn't need to be added to a project labels Mar 10, 2025
@Nodonisko Nodonisko changed the title chore: upgrade to TS 5.6 chore: upgrade to TS 5.8 Mar 10, 2025
Copy link

coderabbitai bot commented Mar 10, 2025

Walkthrough

This pull request includes updates across several project files. Multiple package.json files have been revised to update dependency versions—most notably for TypeScript, @types/node, and long—across various packages and examples. In addition, the mobile expo project now uses a fixed version of TypeScript instead of a range. Changes in the source code adjust the handling of Buffer instances, ensuring that values are correctly cast or converted to hexadecimal strings in specific utility functions. The method signature in a hashing function has been broadened to accept a wider range of buffer types. Furthermore, the JSX formatter component was reformatted to use an explicit return syntax, and the compiler target in the TypeScript configuration has been updated from "esnext" to "ES2023". These modifications standardize dependency versions and improve type handling throughout the codebase.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4a0a83a and 506f007.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (1)
  • packages/eslint/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/eslint/package.json
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: PR-check / node-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / node-override init-api-flaky
  • GitHub Check: PR-check / web-override init-api-flaky
  • GitHub Check: PR-check / web-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: build-deploy
  • GitHub Check: run-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-desktop-tests (@group=other, trezor-user-env-unix)
  • GitHub Check: run-desktop-tests (@group=passphrase, trezor-user-env-unix)
  • GitHub Check: run-desktop-tests (@group=settings, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-desktop-tests (@group=device-management, trezor-user-env-unix)
  • GitHub Check: run-desktop-tests (@group=suite, trezor-user-env-unix)
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: build-web
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: prepare_android_test_app
  • GitHub Check: build-deploy
  • GitHub Check: EAS Update
  • GitHub Check: transport-e2e-test
  • GitHub Check: test
  • GitHub Check: Socket Security: Pull Request Alerts

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
suite-common/formatters/src/makeFormatter.tsx (1)

47-49: Improved syntax for JSX component return

The component has been updated to use explicit parentheses for the JSX return value, which is a good practice for clarity. However, I noticed that the null coalescing operator (?? null) has been removed, which means the component will now return an empty fragment instead of null when the formatted output is nullish.

While this doesn't affect typical usage patterns, it's worth noting that the component interface on line 33 allows for returning JSX.Element | null. The updated implementation aligns better with React best practices but has a slightly different behavior.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6fb2159 and 4594163.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (10)
  • package.json (3 hunks)
  • packages/connect-examples/mobile-expo/package.json (1 hunks)
  • packages/connect/src/api/cipherKeyValue.ts (1 hunks)
  • packages/protobuf/package.json (1 hunks)
  • packages/protobuf/tsconfig.json (1 hunks)
  • packages/trezor-user-env-link/package.json (1 hunks)
  • packages/utxo-lib/src/transaction/zcash.ts (1 hunks)
  • suite-common/formatters/src/makeFormatter.tsx (1 hunks)
  • suite-native/app/package.json (2 hunks)
  • tsconfig.base.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (15)
  • GitHub Check: build-deploy
  • GitHub Check: build-deploy
  • GitHub Check: run-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-desktop-tests (@group=other, trezor-user-env-unix)
  • GitHub Check: run-desktop-tests (@group=passphrase, trezor-user-env-unix)
  • GitHub Check: run-desktop-tests (@group=settings, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-desktop-tests (@group=device-management, trezor-user-env-unix)
  • GitHub Check: build-web
  • GitHub Check: run-desktop-tests (@group=suite, trezor-user-env-unix)
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: transport-e2e-test
  • GitHub Check: prepare_android_test_app
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: test
  • GitHub Check: Socket Security: Pull Request Alerts
🔇 Additional comments (12)
packages/protobuf/package.json (1)

37-39: Upgrade Dependency "long" Version
The long dependency has been updated from "5.2.0" to "5.2.5", aligning with dependency standardization across the project. Please verify that this patch version is fully backward compatible with existing usages.

packages/trezor-user-env-link/package.json (1)

17-19: Update TypeScript Version in DevDependencies
The TypeScript package in devDependencies is now fixed to version "5.8.2" (up from "5.5.4"). This change helps ensure consistency across workspaces. Double-check that the updates in TS configuration (and any API changes between releases) are compatible with this version.

tsconfig.base.json (1)

8-10: Change Compilation Target to ES2023
The target in compilerOptions has been updated from "esnext" to "ES2023". This explicit target standardizes the ECMAScript features used in the output. Please ensure that all deployment environments support ES2023 features and that this change does not inadvertently impact any cross-environment compatibility.

packages/connect-examples/mobile-expo/package.json (1)

18-23: Pin TypeScript Version for Mobile Expo Example
The TypeScript version under devDependencies has been changed from a caret version (^5.3.3) to a fixed version ("5.8.2"). This ensures consistency with other packages in the repository. Verify that Expo or any other tooling used in this package does not require a looser version range.

package.json (2)

90-100: Update Resolutions for TypeScript and @types/node
Within the resolutions section, the TypeScript version is now set to "5.8.2" and @types/node has been updated from "22.10.1" to "22.13.10". This change supports uniform dependency management across the project. It is advisable to verify that all packages depending on these resolutions behave as expected.


120-145: Upgrade DevDependencies for TypeScript and Node Types
In the devDependencies section, the TypeScript package has been updated to "5.8.2" and @types/node to "22.13.10". Ensure that these upgrades align with your build, lint, and test configurations and that there are no breaking changes introduced by the newer TypeScript version.

packages/protobuf/tsconfig.json (1)

3-6:

✅ Verification successful

Added allowSyntheticDefaultImports for better module compatibility.

This configuration change enables synthetic default imports, which is a good practice when working with modules that don't have explicit default exports (common in many libraries).


🏁 Script executed:

#!/bin/bash
# Check if any imports in the codebase might benefit from this configuration
grep -r "import \* as " packages/protobuf/src/ | head -5

Length of output: 283


Approval Confirmed: allowSyntheticDefaultImports correctly enables better module compatibility.

The configuration update in packages/protobuf/tsconfig.json is validated by source files importing modules with the import * as syntax (e.g., in packages/protobuf/src/index.ts, packages/protobuf/src/types.ts, and packages/protobuf/src/utils.ts). This change is appropriate and beneficial for handling modules without explicit default exports.

suite-native/app/package.json (2)

139-139: Updated Node types version to match TypeScript upgrade.

The update to @types/node v22.13.10 is appropriate for compatibility with the TypeScript upgrade.


148-148: Pinned TypeScript version for consistency.

Good practice to use a fixed version (5.8.2) rather than caret range for TypeScript, ensuring all developers use exactly the same compiler version.

packages/utxo-lib/src/transaction/zcash.ts (1)

312-315: Improved Buffer handling for TypeScript 5.8 compatibility.

This change properly handles Buffer types with the updated TypeScript version. The refactoring:

  1. Uses a more specific Buffer type signature for better type safety
  2. Creates a variable to hold the converted buffer, improving code readability
  3. Maintains identical functionality while adapting to TypeScript's stricter type system
packages/connect/src/api/cipherKeyValue.ts (2)

37-40: Enhanced Buffer handling for TypeScript 5.8 compatibility.

The refactoring improves type safety by explicitly casting non-Buffer values to string type while maintaining the same functionality. The multi-line formatting also improves readability.


44-44: Explicit type casting for IV parameter.

Similar to the value parameter change, this improvement adds explicit type casting for better compatibility with TypeScript 5.8's stricter type checking.

Copy link

github-actions bot commented Mar 10, 2025

🚀 Expo preview is ready!

  • Project → trezor-suite-preview
  • Platforms → android, ios
  • Scheme → trezorsuitelite
  • Runtime Version → 26
  • More info

Learn more about 𝝠 Expo Github Action

Copy link

socket-security bot commented Mar 10, 2025

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring: npm/@eslint/[email protected]

View full report↗︎

Next steps

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

@komret
Copy link
Contributor

komret commented Mar 10, 2025

The component has been updated to use explicit parentheses for the JSX return value, which is a good practice for clarity. However, I noticed that the null coalescing operator (?? null) has been removed, which means the component will now return an empty fragment instead of null when the formatted output is nullish.
While this doesn't affect typical usage patterns, it's worth noting that the component interface on line 33 allows for returning JSX.Element | null. The updated implementation aligns better with React best practices but has a slightly different behavior.

Looks like a valid point, @Nodonisko.

@Lemonexe
Copy link
Contributor

@SocketSecurity ignore npm/@eslint/[email protected]
it's a package recently published by eslint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
monorepo Task about monorepo management no-project This label is used to specify that PR doesn't need to be added to a project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants