Skip to content

Commit

Permalink
fix: Ensure type for init is correct in meta frameworks (#13938)
Browse files Browse the repository at this point in the history
Fixes #13932

We have defined the type for the shared client/server types in
meta-frameworks incorrectly, `init` now returns `Client | undefined` and
not `void` anymore.
  • Loading branch information
mydea authored Oct 11, 2024
1 parent 4a2da31 commit 1d87cec
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/astro/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ export * from '@sentry/node';

import type { NodeOptions } from '@sentry/node';

import type { Integration, Options, StackParser } from '@sentry/types';
import type { Client, Integration, Options, StackParser } from '@sentry/types';

import type * as clientSdk from './index.client';
import type * as serverSdk from './index.server';
import sentryAstro from './index.server';

/** Initializes Sentry Astro SDK */
export declare function init(options: Options | clientSdk.BrowserOptions | NodeOptions): void;
export declare function init(options: Options | clientSdk.BrowserOptions | NodeOptions): Client | undefined;

export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration;
export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration;
Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export * from './client';
export * from './server';
export * from './edge';

import type { Integration, Options, StackParser } from '@sentry/types';
import type { Client, Integration, Options, StackParser } from '@sentry/types';

import type * as clientSdk from './client';
import type { ServerComponentContext, VercelCronsConfig } from './common/types';
Expand All @@ -17,7 +17,7 @@ import type * as serverSdk from './server';
/** Initializes Sentry Next.js SDK */
export declare function init(
options: Options | clientSdk.BrowserOptions | serverSdk.NodeOptions | edgeSdk.EdgeOptions,
): void;
): Client | undefined;

export declare const getClient: typeof clientSdk.getClient;
export declare const getRootSpan: typeof serverSdk.getRootSpan;
Expand Down
4 changes: 2 additions & 2 deletions packages/nuxt/src/index.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Integration, Options, StackParser } from '@sentry/types';
import type { Client, Integration, Options, StackParser } from '@sentry/types';
import type { SentryNuxtClientOptions } from './common/types';
import type * as clientSdk from './index.client';
import type * as serverSdk from './index.server';
Expand All @@ -9,7 +9,7 @@ export * from './index.client';
export * from './index.server';

// re-export colliding types
export declare function init(options: Options | SentryNuxtClientOptions | serverSdk.NodeOptions): void;
export declare function init(options: Options | SentryNuxtClientOptions | serverSdk.NodeOptions): Client | undefined;
export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration;
export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration;
export declare const getDefaultIntegrations: (options: Options) => Integration[];
Expand Down
4 changes: 2 additions & 2 deletions packages/remix/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
export * from './index.client';
export * from './index.server';

import type { Integration, Options, StackParser } from '@sentry/types';
import type { Client, Integration, Options, StackParser } from '@sentry/types';

import * as clientSdk from './index.client';
import * as serverSdk from './index.server';
import type { RemixOptions } from './utils/remixOptions';

/** Initializes Sentry Remix SDK */
export declare function init(options: RemixOptions): void;
export declare function init(options: RemixOptions): Client | undefined;

export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration;
export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration;
Expand Down
4 changes: 2 additions & 2 deletions packages/solidstart/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ export * from './client';
export * from './server';
export * from './vite';

import type { Integration, Options, StackParser } from '@sentry/types';
import type { Client, Integration, Options, StackParser } from '@sentry/types';

import type * as clientSdk from './client';
import type * as serverSdk from './server';

/** Initializes Sentry Solid Start SDK */
export declare function init(options: Options | clientSdk.BrowserOptions | serverSdk.NodeOptions): void;
export declare function init(options: Options | clientSdk.BrowserOptions | serverSdk.NodeOptions): Client | undefined;

export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration;
export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration;
Expand Down
4 changes: 2 additions & 2 deletions packages/sveltekit/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ export * from './client';
export * from './vite';
export * from './server';

import type { Integration, Options, StackParser } from '@sentry/types';
import type { Client, Integration, Options, StackParser } from '@sentry/types';
import type { HandleClientError, HandleServerError } from '@sveltejs/kit';

import type * as clientSdk from './client';
import type * as serverSdk from './server';

/** Initializes Sentry SvelteKit SDK */
export declare function init(options: Options | clientSdk.BrowserOptions | serverSdk.NodeOptions): void;
export declare function init(options: Options | clientSdk.BrowserOptions | serverSdk.NodeOptions): Client | undefined;

export declare function handleErrorWithSentry<T extends HandleClientError | HandleServerError>(handleError?: T): T;

Expand Down

0 comments on commit 1d87cec

Please sign in to comment.