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

ref(js): Use Scope class rather than Scope type for top-level functions #2627

Merged
merged 4 commits into from
Nov 21, 2022

Conversation

lobsterkatie
Copy link
Member

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

This switches the functions defined in sdk.ts from using the Scope interface for typing to using the Scope class for typing, so that the types of withScope here and withScope from the main JS repo match.

💡 Motivation and Context

Fixes getsentry/sentry-javascript#6217.

I steered the OP of the above issue toward a different approach, so in the end he may avoid this problem regardless, but the error he was getting points out the mismatched types.

💚 How did you test it?

I have not tested it. Total mea culpa, I didn't want to go through and set up a whole RN SDK dev environment just for this tiny change, so I did it through the GH UI. I'm hoping that one of my esteemed colleagues might be willing to test it out and see if I've messed up the types anywhere else in the SDK. 🙏🏻

I'll leave this a draft for now, until it's tested.

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • All tests passing
  • No breaking changes

I guess conceivably this could be a breaking change, but only if someone has explicitly typed their withScope callback, which feels pretty unlikely.

🔮 Next steps

Figure out if any other types need to be changed elsewhere in the SDK.

@krystofwoldrich krystofwoldrich marked this pull request as ready for review November 21, 2022 15:37
Copy link
Member

@krystofwoldrich krystofwoldrich left a comment

Choose a reason for hiding this comment

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

LGTM. I would keep it as a fix, the specific withScope is quite a recent change in RN, before that we were just reexporting the one from JS.

CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com>
@lobsterkatie
Copy link
Member Author

LGTM. I would keep it as a fix, the specific withScope is quite a recent change in RN, before that we were just reexporting the one from JS.

Great. Thanks for testing it out, @krystofwoldrich! Feel free to merge this (or I can do it once CI passes and I get back from walking the dogs).

@krystofwoldrich krystofwoldrich merged commit 3426396 into main Nov 21, 2022
@krystofwoldrich krystofwoldrich deleted the kmclb-use-scope-class-for-typing-exports branch November 21, 2022 19:08
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.

Can't use @sentry/core as @sentry/hub replacement type
3 participants