File tree Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,11 @@ import { constructWebpackConfigFunction } from './webpack';
1111export function withSentryConfig (
1212 userNextConfig : ExportedNextConfig = { } ,
1313 userSentryWebpackPluginOptions : Partial < SentryWebpackPluginOptions > = { } ,
14- ) : NextConfigFunction | NextConfigObject {
14+ ) : NextConfigFunction | Partial < NextConfigObject > {
1515 // If the user has passed us a function, we need to return a function, so that we have access to `phase` and
1616 // `defaults` in order to pass them along to the user's function
1717 if ( typeof userNextConfig === 'function' ) {
18- return function ( phase : string , defaults : { defaultConfig : NextConfigObject } ) : NextConfigObject {
18+ return function ( phase : string , defaults : { defaultConfig : NextConfigObject } ) : Partial < NextConfigObject > {
1919 const materializedUserNextConfig = userNextConfig ( phase , defaults ) ;
2020 return {
2121 ...materializedUserNextConfig ,
Original file line number Diff line number Diff line change @@ -7,13 +7,13 @@ export type SentryWebpackPlugin = { options: SentryWebpackPluginOptions };
77 * Overall Nextjs config
88 */
99
10- export type ExportedNextConfig = NextConfigObject | NextConfigFunction ;
10+ export type ExportedNextConfig = Partial < NextConfigObject > | NextConfigFunction ;
1111
1212export type NextConfigObject = {
1313 // custom webpack options
14- webpack ? : WebpackConfigFunction ;
14+ webpack : WebpackConfigFunction ;
1515 // whether to build serverless functions for all pages, not just API routes
16- target ? : 'server' | 'experimental-serverless-trace' ;
16+ target : 'server' | 'experimental-serverless-trace' ;
1717 sentry ?: {
1818 disableServerWebpackPlugin ?: boolean ;
1919 disableClientWebpackPlugin ?: boolean ;
@@ -25,8 +25,8 @@ export type NextConfigObject = {
2525
2626export type NextConfigFunction = (
2727 phase : string ,
28- defaults : { defaultConfig : { [ key : string ] : unknown } } ,
29- ) => NextConfigObject ;
28+ defaults : { defaultConfig : NextConfigObject } ,
29+ ) => Partial < NextConfigObject > ;
3030
3131/**
3232 * Webpack config
@@ -56,7 +56,7 @@ export type BuildContext = {
5656 isServer : boolean ;
5757 buildId : string ;
5858 dir : string ;
59- config : Partial < NextConfigObject > ;
59+ config : NextConfigObject ;
6060 webpack : { version : string } ;
6161} ;
6262
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export { SentryWebpackPlugin };
3434 * @returns The function to set as the nextjs config's `webpack` value
3535 */
3636export function constructWebpackConfigFunction (
37- userNextConfig : NextConfigObject = { } ,
37+ userNextConfig : Partial < NextConfigObject > = { } ,
3838 userSentryWebpackPluginOptions : Partial < SentryWebpackPluginOptions > = { } ,
3939) : WebpackConfigFunction {
4040 // Will be called by nextjs and passed its default webpack configuration and context data about the build (whether
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ process.env.SENTRY_RELEASE = 'doGsaREgReaT';
5858const runtimePhase = 'ball-fetching' ;
5959// `defaultConfig` is the defaults for all nextjs options (we don't use these at all in the tests, so for our purposes
6060// here the values don't matter)
61- const defaultsObject = { defaultConfig : { } } ;
61+ const defaultsObject = { defaultConfig : { } as NextConfigObject } ;
6262
6363/** mocks of the arguments passed to `nextConfig.webpack` */
6464const serverWebpackConfig = {
@@ -103,7 +103,7 @@ function getBuildContext(
103103 dev : false ,
104104 buildId : 'sItStAyLiEdOwN' ,
105105 dir : '/Users/Maisey/projects/squirrelChasingSimulator' ,
106- config : { target : 'server' , ...userNextConfig } ,
106+ config : { target : 'server' , ...userNextConfig } as NextConfigObject ,
107107 webpack : { version : webpackVersion } ,
108108 isServer : buildTarget === 'server' ,
109109 } ;
You can’t perform that action at this time.
0 commit comments