ref(js): Use Scope
class rather than Scope
type for top-level functions
#2627
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.
📢 Type of change
📜 Description
This switches the functions defined in
sdk.ts
from using theScope
interface for typing to using theScope
class for typing, so that the types ofwithScope
here andwithScope
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 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.