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.14.0
Important Changes
- feat(nestjs): Filter 4xx errors (#12695)
The @sentry/nestjs
SDK no longer captures 4xx errors automatically.
Other Changes
- chore(react): Remove private namespace
JSX
(#12691) - feat(deps): bump @opentelemetry/propagator-aws-xray from 1.25.0 to 1.25.1 (#12719)
- feat(deps): bump @prisma/instrumentation from 5.16.0 to 5.16.1 (#12718)
- feat(node): Add
registerEsmLoaderHooks
option (#12684) - feat(opentelemetry): Expose sampling helper (#12674)
- fix(browser): Make sure measure spans have valid start timestamps (#12648)
- fix(hapi): Widen type definitions (#12710)
- fix(nextjs): Attempt to ignore critical dependency warnings (#12694)
- fix(react): Fix React jsx runtime import for esm (#12740)
- fix(replay): Start replay in
afterAllSetup
instead of next tick (#12709)
Work in this release was contributed by @quisido. Thank you for your contribution!