@@ -20,11 +20,14 @@ let showedExportModeTunnelWarning = false;
2020 * @param sentryBuildOptions Additional options to configure instrumentation and
2121 * @returns The modified config to be exported
2222 */
23- // TODO(v9): Always return an async function here to allow us to do async things like grabbing a deterministic build ID.
24- export function withSentryConfig < C > ( nextConfig ?: C , sentryBuildOptions : SentryBuildOptions = { } ) : C {
23+ export function withSentryConfig (
24+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25+ nextConfig ?: any ,
26+ sentryBuildOptions : SentryBuildOptions = { } ,
27+ ) : NextConfigFunction {
2528 const castNextConfig = ( nextConfig as NextConfig ) || { } ;
26- if ( typeof castNextConfig === 'function' ) {
27- return function ( this : unknown , ... webpackConfigFunctionArgs : unknown [ ] ) : ReturnType < NextConfigFunction > {
29+ return async function ( this : unknown , ... webpackConfigFunctionArgs : unknown [ ] ) : ReturnType < NextConfigFunction > {
30+ if ( typeof castNextConfig === 'function' ) {
2831 const maybePromiseNextConfig : ReturnType < typeof castNextConfig > = castNextConfig . apply (
2932 this ,
3033 webpackConfigFunctionArgs ,
@@ -37,10 +40,10 @@ export function withSentryConfig<C>(nextConfig?: C, sentryBuildOptions: SentryBu
3740 }
3841
3942 return getFinalConfigObject ( maybePromiseNextConfig , sentryBuildOptions ) ;
40- } as C ;
41- } else {
42- return getFinalConfigObject ( castNextConfig , sentryBuildOptions ) as C ;
43- }
43+ } else {
44+ return getFinalConfigObject ( castNextConfig , sentryBuildOptions ) ;
45+ }
46+ } ;
4447}
4548
4649// Modify the materialized object form of the user's next config by deleting the `sentry` property and wrapping the
0 commit comments