-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
9.27.0
Framework Version
No response
Link to Sentry event
No response
Reproduction Example/SDK Setup

I used the beforeSendSpan
to intentionally drop a certain span, but once I added return null
TypeScript warned me that the type of my callback doesn't match the expected type the SDK has defined. The docs in the preview say:
Returning null will cause this span to be dropped.
That's exactly what I wanted to achieve, but I'll have to mute typescript on that line. Is this the intended behavior? If we are allowed to return null
to intentionally drop spans, then the SDK should define the expected type as (span: SpanJSON): SpanJSON | null
instead.
Steps to Reproduce
Add return null
in beforeSendSpan
Expected Result
No TypeScript error should appear
Actual Result
Getting a type mismatch
Metadata
Metadata
Assignees
Type
Projects
Status
No status