Skip to content

Conversation

@JPeer264
Copy link
Member

@JPeer264 JPeer264 commented Nov 4, 2025

Description

This PR is a starting point of upgrading to TypeScript and preparing for future upgrades around testing and maintenance.

I've seen that couple of types between the *.js files and the index.d.ts were not 100% in sync, which is one of the reasons the move to TypeScript natively could help here.

What's new / changed

  • moved js to lib in order to keep js as the same output folder which is delivered to NPM
  • js/index.d.ts stays as type export for NPM and the types are re-exported via the jsdoc @typedef
  • types.ts is actually the same as the previous index.d.ts excluding the SentryCli class
  • TypeScript is partially used to keep the changes minimal
  • I aligned the jsdoc types with the actual text from the previous index.d.ts

@JPeer264 JPeer264 requested a review from a team as a code owner November 4, 2025 13:49
@JPeer264 JPeer264 force-pushed the jp/change-to-typescript branch from da498c2 to b90e8fa Compare November 4, 2025 14:26
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@JPeer264 JPeer264 force-pushed the jp/change-to-typescript branch from 1d8386e to 40f67ab Compare November 4, 2025 15:03
@JPeer264
Copy link
Member Author

JPeer264 commented Nov 4, 2025

@andreiborza this is now ready to review. Had some issues with the postinstall, but this is solved now.

Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

Added some comments, mostly containing some noob JS questions.

My one concern is: several of the changes here look like they might break the public JS API; am I understanding that correctly?

@JPeer264
Copy link
Member Author

JPeer264 commented Nov 5, 2025

My one concern is: several of the changes here look like they might break the public JS API; am I understanding that correctly?

If you run npm install --ignore-scripts and npm run build locally - you'll see that the index.d.ts inside js-dist is exporting the same types as before (just a slightly different format). So there shouldn't be any breaking changes regarding the API.

Copy link
Member

@andreiborza andreiborza left a comment

Choose a reason for hiding this comment

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

Very nice!

@JPeer264 JPeer264 force-pushed the jp/change-to-typescript branch from 9815a2d to 46189d1 Compare November 7, 2025 11:29
@JPeer264 JPeer264 requested a review from andreiborza November 7, 2025 11:31
"postinstall": "node ./scripts/install.js",
"postinstall": "npm run install-cli",
"build": "tsc",
"postbuild": "npm run install-cli",
Copy link

Choose a reason for hiding this comment

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

Bug: NPM Postbuild Re-downloads Binary After Compile

The postbuild hook running npm run install-cli causes the CLI binary download script to execute after every TypeScript compilation. This creates unnecessary overhead during development since rebuilding TypeScript source doesn't require re-downloading or re-verifying the binary, and could fail in offline environments or slow down builds significantly with network latency.

Fix in Cursor Fix in Web

@JPeer264 JPeer264 force-pushed the jp/change-to-typescript branch from 46189d1 to 587c934 Compare November 7, 2025 11:47
Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

I'll wait for @andreiborza to approve this, then I can provide a stamp (I think my approval is needed for some of the changes based on the code owner config)

@andreiborza
Copy link
Member

@szokeasaurusrex approved :)

Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

noice

@JPeer264 JPeer264 force-pushed the jp/change-to-typescript branch from 587c934 to be48e79 Compare November 17, 2025 07:44
@JPeer264 JPeer264 enabled auto-merge (squash) November 17, 2025 07:46
@JPeer264 JPeer264 merged commit f9878c8 into master Nov 17, 2025
28 checks passed
@JPeer264 JPeer264 deleted the jp/change-to-typescript branch November 17, 2025 07:48
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.

4 participants