Type 'Tracing' is not assignable to type 'Integration'.
See original GitHub issue- Review the documentation: https://docs.sentry.io/
- Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
- Use the latest release: https://github.com/getsentry/sentry-javascript/releases
- Provide a link to the affected event from your Sentry account
Package + Version
- [5.17.0]
@sentry/browser
- [5.17.0]
@sentry/apm
- [3.9.3]
typescript
Version:
5.17.0
Description
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: <SENTRY.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)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:12 (3 by maintainers)
Top GitHub Comments
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 🙂
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: