diff --git a/packages/nuxt/src/common/types.ts b/packages/nuxt/src/common/types.ts index 62496001273b..02e0b53bac7c 100644 --- a/packages/nuxt/src/common/types.ts +++ b/packages/nuxt/src/common/types.ts @@ -3,9 +3,10 @@ import type { SentryRollupPluginOptions } from '@sentry/rollup-plugin'; import type { SentryVitePluginOptions } from '@sentry/vite-plugin'; import type { init as initVue } from '@sentry/vue'; -// Omitting 'app' as the Nuxt SDK will add the app instance in the client plugin (users do not have to provide this) +// Omitting Vue 'app' as the Nuxt SDK will add the app instance in the client plugin (users do not have to provide this) +// Adding `& object` helps TS with inferring that this is not `undefined` but an object type export type SentryNuxtClientOptions = Omit[0] & object, 'app'>; -export type SentryNuxtServerOptions = Omit[0] & object, 'app'>; +export type SentryNuxtServerOptions = Parameters[0] & object; type SourceMapsOptions = { /** diff --git a/packages/nuxt/src/index.types.ts b/packages/nuxt/src/index.types.ts index dc9bf360af9e..b1393a076029 100644 --- a/packages/nuxt/src/index.types.ts +++ b/packages/nuxt/src/index.types.ts @@ -1,7 +1,6 @@ import type { Client, Integration, Options, StackParser } from '@sentry/core'; -import type { SentryNuxtClientOptions } from './common/types'; +import type { SentryNuxtClientOptions, SentryNuxtServerOptions } from './common/types'; import type * as clientSdk from './index.client'; -import type * as serverSdk from './index.server'; // We export everything from both the client part of the SDK and from the server part. Some of the exports collide, // which is not allowed, unless we re-export the colliding exports in this file - which we do below. @@ -9,7 +8,7 @@ export * from './index.client'; export * from './index.server'; // re-export colliding types -export declare function init(options: Options | SentryNuxtClientOptions | serverSdk.NodeOptions): Client | undefined; +export declare function init(options: Options | SentryNuxtClientOptions | SentryNuxtServerOptions): Client | undefined; export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration; export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration; export declare const getDefaultIntegrations: (options: Options) => Integration[];