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

fix(connect): test install to use target ES2019 #16927

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

karliatto
Copy link
Member

Description

It looks like target ES2022 was not required, having ES2019 with DOM,ES2022.error lib was enough to satisfy typescript.

@karliatto karliatto added the no-project This label is used to specify that PR doesn't need to be added to a project label Feb 11, 2025
Copy link
Contributor

@mroz22 mroz22 left a comment

Choose a reason for hiding this comment

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

yes, lets target the minimum required levels.
didn't you want to change

--lib ES2022,DOM,ES2022.error

to

--lib DOM,ES2022.error

?

@karliatto karliatto force-pushed the fix/target-in-yarn-test-install branch from 18cb6f7 to f62f260 Compare February 11, 2025 12:32
@karliatto
Copy link
Member Author

yes, lets target the minimum required levels. didn't you want to change

--lib ES2022,DOM,ES2022.error

to

--lib DOM,ES2022.error

?

I tested and ES2022 is required but ES2022.error was not. So I removed it.

@karliatto
Copy link
Member Author

It will also work with --target ES2015 but I set it for ES2019 since is what we use in the project.

Copy link

coderabbitai bot commented Feb 11, 2025

Walkthrough

The diff updates the TypeScript compilation settings in the test-yarn-install.sh script. The TypeScript compilation command is modified to change the target ECMAScript version from ES2022 to ES2019. Additionally, the libraries provided to the compiler have been changed: it now specifies ES2022,DOM instead of the previous node,w3c-web-usb configuration. There are no modifications to the declarations of exported or public entities.


🪧 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. (Beta)
  • @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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8c07184 and f62f260.

📒 Files selected for processing (1)
  • packages/connect/e2e/test-yarn-install.sh (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Type Checking
  • GitHub Check: Unit Tests
  • GitHub Check: build-deploy
  • GitHub Check: prepare_android_test_app
  • GitHub Check: Analyze with CodeQL (javascript)
🔇 Additional comments (1)
packages/connect/e2e/test-yarn-install.sh (1)

25-25: Verify library configuration and consider adding ES2022.error.

The PR objectives mention that ES2022.error library is needed, but it's not included in the TypeScript compilation command. Additionally, let's verify if the types node and w3c-web-usb are still required.

Consider updating the command to include the necessary libraries:

-yarn tsc ./index.ts --types node,w3c-web-usb --esModuleInterop --lib ES2022,DOM --target ES2019 --module commonjs 
+yarn tsc ./index.ts --types node,w3c-web-usb --esModuleInterop --lib ES2022,DOM,ES2022.error --target ES2019 --module commonjs 

Let's verify if the types are still needed:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check if the types are used in the codebase
rg -l "w3c-web-usb|WebUSB" .

Length of output: 3759


I'll search the repository for any existing references to ES2022.error in configuration files to determine if it's already used elsewhere or needed.


🏁 Script executed:

#!/bin/bash
# Search for any tsconfig or files referencing ES2022.error
rg "ES2022\.error" .

Length of output: 22


Action: Update the compilation command to include ES2022.error, while keeping both node and w3c-web-usb types.

  • Searches confirm that references to WebUSB (and by extension w3c-web-usb) appear in multiple parts of the codebase, so removing them is not advisable.
  • Although there’s no existing reference to ES2022.error in any configuration file, the PR objectives specify its need. This suggests the omission is likely an oversight, and the command should be updated as proposed.

@@ -22,5 +22,5 @@ echo import TrezorConnect from \"@trezor/connect\" >index.ts

# compile with typescript
yarn add [email protected]
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify the TypeScript version.

The TypeScript version 5.5.4 seems to be from the future. Let's verify the latest stable version.


🌐 Web query:

What is the latest stable version of TypeScript?

💡 Result:

As of February 2025, the latest stable version of TypeScript is 5.7.3[8]. This version includes performance improvements, enhanced type checking capabilities, and continued support for modern ECMAScript features while maintaining backward compatibility with previous releases[4][7].

The current beta release is TypeScript 5.8[2], which developers can test through npm using npm install -D typescript@beta. However, for production environments, Microsoft recommends using the stable 5.7.x branch until 5.8 completes its testing phase[7][9].

Key details about recent versions:

  • TypeScript 5.7 introduced isolated declaration generation and improved regular expression syntax checking[4]
  • Version 5.6 added support for the ECMAScript Set methods proposal[2]
  • The package size has been optimized through tree-shaking and module system improvements since TypeScript 5.0[1]

To install the latest stable version:

npm install -D typescript

Developers can verify their installed version using:

tsc --version

Citations:


Update TypeScript version and align library configuration.

  • The installation command pins TypeScript to version 5.5.4, which is behind the current stable release (5.7.3 as of February 2025). Consider updating to 5.7.3.
  • Additionally, the library flags in the configuration differ from the PR objectives (the PR mentions using ES2022.error, yet the script uses ES2022,DOM). This inconsistency should be reviewed and corrected.

@karliatto
Copy link
Member Author

@mroz22 What do you think? should we do like this?
We can do a minor release and add a good explanation to the changelog regarding the types.
At the end it should just work adding to lib configuration in typescript ES2022,DOM if they are using some target below ES2022.
If they are using target above ES2022 there should not be any configuration changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants