-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Multiple incompatible Scope
types in v8.x
#12053
Comments
To make it worse, the re-exported withScope in @sentry/node is using this different Scope, so even an import line like Nor does this work
|
Hey, could you share the actual code that is triggering this problem for you? e.g. import {Scope} from '@sentry/node';
function myFunction(scope: Scope): void {
xxx(scope);
} It should be the case that you can pass the scope from |
Sorry, I didn't write properly in the issue description, but it's exactly what @roderik is mentioning as well. import { type Scope, withScope } from '@sentry/node';
withScope((scope: Scope) => {});
// ^
// Argument of type
// 'import(".../node_modules/@sentry/types/types/scope").Scope'
// is not assignable to parameter of type
// 'import(".../node_modules/@sentry/core/types/scope").Scope'.
This was not the case in v7, where the The class and the interface are not compatible with each other. |
Ah, I see now. Yeah, this is a bit annoying/tricky. What you can do for now is install import { withScope } from '@sentry/node';
import type { Scope } from '@sentry/types';
withScope(scope: Scope, () => {}); (that, or let the type be inferred, which should be correct as well). I have opened a PR to fix this behavior in the next version: #12067 |
Is there an existing issue for this?
How do you use Sentry?
Self-hosted/on-premise
Which SDK are you using?
@sentry/node
SDK Version
8.0.0
Framework Version
NestJS 10
Link to Sentry event
No response
SDK Setup
No response
Steps to Reproduce
It seems there are multiple types for
Scope
which are incompatible with each other.withScope()
from@sentry/core
is usingScope
from@sentry/types
, but there is also aScope
in@sentry/core
.Both are directly or indirectly exported also by
@sentry/node
.Expected Result
We tend to use everything from
@sentry/node
(since we should not care about the internals of Sentry). It would be great to have proper type compatibility.Actual Result
The two
Scope
types are not compatible with each other:The text was updated successfully, but these errors were encountered: