Skip to content

feat: Move javascript files to native typescript - #2989

Merged
szokeasaurusrex merged 1 commit into
masterfrom
jp/move-to-native-typescript
Dec 15, 2025
Merged

feat: Move javascript files to native typescript#2989
szokeasaurusrex merged 1 commit into
masterfrom
jp/move-to-native-typescript

Conversation

@JPeer264

@JPeer264 JPeer264 commented Nov 26, 2025

Copy link
Copy Markdown
Member

(closes #2617)
(closes CLI-142)

This PR migrates all JavaScript files in the lib/ directory to native TypeScript, removing the need for JSDoc type annotations and improving type safety.

Main Changes

  • Converted all .js files to .ts with proper TypeScript syntax
  • Changed module system from CommonJS to ES6 modules for better TypeScript interoperability
  • Updated exports to use ES6 export syntax instead of module.exports
  • All types are now exported as named exports for better type inference and IDE support
  • OptionsSchema is now a union to satisfy SOURCEMAPS_OPTIONS, as this one didn't had the required param
  • The exports of lib/releases/options has changed its name

Breaking Changes

Module Exports

  • Before: module.exports = SentryCli; (CommonJS)
  • After: export class SentryCli { ... } (ES6 named export)

We could have maintained backwards compatibility with export = SentryCli;. The only problem were the types which needed to be exported as well. With ES6 named exports, we can now export all types alongside the class.

Internal Improvements

Simplified Release constructor

  • Before: new Releases({ ...this.options, configFile }) - configFile was merged into options
  • After: new Releases(this.options, configFile) - two separate parameters

With 2 parameters it's easier to maintain and makes the separation of concerns clearer.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.0 Breaking changes to include in version 3.0.0 of Sentry CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use typescript to generate type declarations

3 participants