Skip to content

Commit 89d748b

Browse files
mydeabillyvg
authored andcommitted
fix: Ensure type for init is correct in meta frameworks (#13938)
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.
1 parent 5a5523e commit 89d748b

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

packages/astro/src/index.types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ export * from '@sentry/node';
77

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

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

1212
import type * as clientSdk from './index.client';
1313
import type * as serverSdk from './index.server';
1414
import sentryAstro from './index.server';
1515

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

1919
export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration;
2020
export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration;

packages/nextjs/src/index.types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export * from './client';
77
export * from './server';
88
export * from './edge';
99

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

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

2222
export declare const getClient: typeof clientSdk.getClient;
2323
export declare const getRootSpan: typeof serverSdk.getRootSpan;

packages/nuxt/src/index.types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Integration, Options, StackParser } from '@sentry/types';
1+
import type { Client, Integration, Options, StackParser } from '@sentry/types';
22
import type { SentryNuxtClientOptions } from './common/types';
33
import type * as clientSdk from './index.client';
44
import type * as serverSdk from './index.server';
@@ -9,7 +9,7 @@ export * from './index.client';
99
export * from './index.server';
1010

1111
// re-export colliding types
12-
export declare function init(options: Options | SentryNuxtClientOptions | serverSdk.NodeOptions): void;
12+
export declare function init(options: Options | SentryNuxtClientOptions | serverSdk.NodeOptions): Client | undefined;
1313
export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration;
1414
export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration;
1515
export declare const getDefaultIntegrations: (options: Options) => Integration[];

packages/remix/src/index.types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
export * from './index.client';
44
export * from './index.server';
55

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

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

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

1515
export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration;
1616
export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration;

packages/solidstart/src/index.types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ export * from './client';
55
export * from './server';
66
export * from './vite';
77

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

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

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

1616
export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration;
1717
export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration;

packages/sveltekit/src/index.types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ export * from './client';
55
export * from './vite';
66
export * from './server';
77

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

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

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

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

0 commit comments

Comments
 (0)