feat: Move javascript files to native typescript - #2989
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(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
.jsfiles to.tswith proper TypeScript syntaxexportsyntax instead ofmodule.exportsOptionsSchemais now a union to satisfySOURCEMAPS_OPTIONS, as this one didn't had the requiredparamlib/releases/optionshas changed its nameBreaking Changes
Module Exports
module.exports = SentryCli;(CommonJS)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
Releaseconstructornew Releases({ ...this.options, configFile })- configFile was merged into optionsnew Releases(this.options, configFile)- two separate parametersWith 2 parameters it's easier to maintain and makes the separation of concerns clearer.