What is @sentry/types?
The @sentry/types package provides TypeScript definitions for Sentry's JavaScript SDK. It includes types for Sentry's configuration options, event objects, and various interfaces used within Sentry's SDKs. This package is primarily used by developers to ensure type safety and autocompletion when working with Sentry in a TypeScript environment.
What are @sentry/types's main functionalities?
Event Interface
Defines the structure of an event that can be sent to Sentry. This includes the event's ID, level, timestamp, platform, and SDK information.
{
event_id: string;
level: 'error' | 'warning' | 'info' | 'debug';
timestamp: number;
platform: string;
sdk: {
name: string;
version: string;
};
}
Options Interface
Specifies the options for configuring the Sentry SDK. This includes the DSN (Data Source Name), breadcrumb limits, debug mode, integrations, and a beforeSend hook for event manipulation.
{
dsn: string;
maxBreadcrumbs: number;
debug: boolean;
integrations: Integration[];
beforeSend: (event: Event) => Event | null;
}
Breadcrumb Interface
Describes a breadcrumb, which is a snapshot of data that describes what happened before an event. This includes the timestamp, message, category, level, and any additional data.
{
timestamp: number;
message: string;
category: string;
level: 'critical' | 'error' | 'warning' | 'info' | 'debug';
data: Record<string, any>;
}
Other packages similar to @sentry/types
@types/node
Provides TypeScript definitions for Node.js. Similar to @sentry/types, it's used for type safety and autocompletion but focuses on Node.js' API rather than Sentry's.
typescript
The TypeScript language itself, which includes its compiler and type system. While not a direct alternative, it's the foundation that packages like @sentry/types build upon to provide type definitions for specific libraries.
@types/react
Offers TypeScript definitions for React. Similar to @sentry/types, it aids in developing React applications with TypeScript by providing types for React's API, but it doesn't relate to error monitoring or logging.
8.0.0-alpha.5
This is the fifth alpha release of Sentry JavaScript SDK v8, which includes a variety of breaking changes.
Read the in-depth migration guide to find out how to address any breaking changes in your code.
Important Changes
- feat(nextjs): Remove
client.(server|client).config.ts
functionality in favor of instrumentation.ts
(#11059)
- feat(nextjs): Bump minimum required Next.js version to
13.2.0
(#11097)
With version 8 of the SDK we will no longer support the use of sentry.server.config.ts
and sentry.edge.config.ts
files. Instead, please initialize the Sentry Next.js SDK for the serverside in a
Next.js instrumentation hook.
sentry.client.config.ts|js
is still supported and encouraged for initializing the clientside SDK. Please see the
Migration Guide for more details.
In addition, the Next.js SDK now requires a minimum Next.js version of 13.2.0
.
- feat(v8/angular): Merge angular and angular-ivy packages and start Angular support at v14 (#11091)
The @sentry/angular-ivy
package has been removed. The @sentry/angular
package now supports Ivy by default and
requires at least Angular 14. See the Migration Guide for more
details.
Removal/Refactoring of deprecated functionality
- feat(aws-serverless): Remove deprecated
rethrowAfterCapture
option (#11126) - feat(node): Remove deprecated/duplicate/unused definitions (#11120)
- feat(v8): Remove deprecated integration methods on client (#11134)
- feat(v8/browser): Remove class export for linked errors (#11129)
- feat(v8/browser): Remove deprecated wrap export (#11127)
- feat(v8/core): Remove deprecated client.setupIntegrations method (#11179)
- feat(v8/core): Remove deprecated integration classes (#11132)
- feat(v8/ember): Remove InitSentryForEmber export (#11202)
- feat(v8/nextjs): Remove usage of class integrations (#11182)
- feat(v8/replay): Delete deprecated types (#11177)
- feat(v8/utils): Remove deprecated util functions (#11143)
- ref(node): Remove class based export for local variable integration (#11128)
Other Changes
- feat(browser): Make fetch the default transport for offline (#11209)
- feat(core): Filter out noisy GoogleTag error by default (#11208)
- feat(deps): Bump @sentry/cli from 2.30.0 to 2.30.2 (#11168)
- feat(nextjs): Prefix webpack plugin log messages with runtime (#11173)
- feat(node-profiling): Output ESM and remove Sentry deps from output (#11135)
- feat(node): Allow Anr worker to be stopped and restarted (#11214)
- feat(node): Support
tunnel
option for ANR (#11163) - feat(opentelemetry): Do not capture exceptions for timed events (#11221)
- feat(serverless): Add Node.js 20 to compatible runtimes (#11103)
- feat(sveltekit): Switch to Otel-based
@sentry/node
package (#11075) - fix(attachments): Add missing
view_hierarchy
attachment type (#11197) - fix(build): Ensure tree shaking works properly for ESM output (#11122)
- fix(feedback): Only allow screenshots in secure contexts (#11188)
- fix(feedback): Reduce force layout in screenshots (#11181)
- fix(feedback): Smoother cropping experience and better UI (#11165)
- fix(feedback): Fix screenshot black bars in Safari (#11233)
- fix(metrics): use correct statsd data category (#11184)
- fix(metrics): use web-vitals ttfb calculation (#11185)
- fix(node): Export
initOpenTelemetry
(#11158) - fix(node): Clear ANR timer on stop (#11229)
- fix(node): Time zone handling for
cron
(#11225) - fix(node): Use unique variable for ANR context transfer (#11161)
- fix(opentelemetry): Do not stomp span error status (#11169)
- fix(types): Fix incorrect
sampled
type on Transaction
(#11115)