@sentry/browser
@sentry/apm
typescript
5.17.0
Describe your issue in detail, ideally, you have a reproducible demo that you can show.
Followed Javascript setup from https://docs.sentry.io/performance/distributed-tracing/?_ga=2.119653007.60898342.1591903247-665646710.1589239592#javascript
import * as Sentry from '@sentry/browser'
import { Integrations as ApmIntegrations } from '@sentry/apm';
Sentry.init({
dsn:
integrations: [new ApmIntegrations.Tracing()],
tracesSampleRate: 0.25
})
will throw a Typescript error
Type 'Tracing' is not assignable to type 'Integration'.
Types of property 'setupOnce' are incompatible.
Type '(addGlobalEventProcessor: (callback: import("node_modules/@sentry/apm/node_modules/@sentry/types/dist/eventprocessor").EventProcessor) => void, getCurrentHub: () => import("/node_modules/@sentry/apm/node_modules/@sentry/hub/dist...' is not assignable to type '(addGlobalEventProcessor: (callback: import("/node_modules/@sentry/types/dist/eventprocessor").EventProcessor) => void, getCurrentHub: () => import("/node_modules/@sentry/types/dist/hub").Hub) => void'.
Types of parameters 'addGlobalEventProcessor' and 'addGlobalEventProcessor' are incompatible.
Types of parameters 'callback' and 'callback' are incompatible.
Type 'import("/node_modules/@sentry/apm/node_modules/@sentry/types/dist/eventprocessor").EventProcessor' is not assignable to type 'import("/node_modules/@sentry/types/dist/eventprocessor").EventProcessor'.
Types of parameters 'event' and 'event' are incompatible.
Type 'import("/node_modules/@sentry/types/dist/event").Event' is not assignable to type 'import("/node_modules/@sentry/apm/node_modules/@sentry/types/dist/event").Event'.
Types of property 'spans' are incompatible.
Type 'import("/node_modules/@sentry/types/dist/span").Span[]' is not assignable to type 'import("/node_modules/@sentry/apm/node_modules/@sentry/types/dist/span").Span[]'.
Type 'Span' is missing the following properties from type 'Span': spanId, traceId, startTimestamp, tags, and 2 more.ts(2322)
It looks like some of the node_modules in your local env. are stale. Try to remove them, clear cache and reinstall all modules. It should fix everything. Sometimes yarn/npm have hard time resolving things, not sure why exactly though. (verified locally with your example code).
@kamilogorek no repro, I will close the ticket. thank you
I encountered the same issue, and solved it by swapping the order of the imports to:
import { Integrations as ApmIntegrations } from '@sentry/apm';
import * as Sentry from "@sentry/browser";
:man_shrugging:
I have to admit I hit this error too. But changing the imports isn't an option here. Might be an issue with Typescript itself.
What helped is casting it:
```
import { Integration } from '@sentry/types';
....
integrations: [new BrowserTracing() as Integration],
麓麓麓
Sharing this for others, who might end up here searching 馃槃
Encountered this just now, upgrading all Sentry modules to their latest versions resolved it. Noticed the type error when @sentry/react
was at v5.29.0 and @sentry/tracing
was at v5.29.2.
Might help others 馃檪
Most helpful comment
Encountered this just now, upgrading all Sentry modules to their latest versions resolved it. Noticed the type error when
@sentry/react
was at v5.29.0 and@sentry/tracing
was at v5.29.2.Might help others 馃檪