Skip to content

Commit 4044067

Browse files
committed
fix types
1 parent f069cb0 commit 4044067

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

packages/nextjs/src/config/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { constructWebpackConfigFunction } from './webpack';
1212
export function withSentryConfig(
1313
userNextConfig: ExportedNextConfig = {},
1414
userSentryWebpackPluginOptions: Partial<SentryWebpackPluginOptions> = {},
15-
): NextConfigFunction | NextConfigObject {
15+
): NextConfigFunction | Partial<NextConfigObject> {
1616
// If the user has passed us a function, we need to return a function, so that we have access to `phase` and
1717
// `defaults` in order to pass them along to the user's function
1818
if (typeof userNextConfig === 'function') {

packages/nextjs/src/config/types.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ export type SentryWebpackPlugin = WebpackPluginInstance & { options: SentryWebpa
88
* Overall Nextjs config
99
*/
1010

11-
export type ExportedNextConfig = NextConfigObject | NextConfigFunction;
11+
export type ExportedNextConfig = Partial<NextConfigObject> | NextConfigFunction;
1212

1313
export type NextConfigObject = {
1414
// custom webpack options
15-
webpack?: WebpackConfigFunction;
15+
webpack: WebpackConfigFunction;
1616
// whether to build serverless functions for all pages, not just API routes
17-
target?: 'server' | 'experimental-serverless-trace';
17+
target: 'server' | 'experimental-serverless-trace';
1818
// the output directory for the built app (defaults to ".next")
19-
distDir?: string;
19+
distDir: string;
2020
sentry?: {
2121
disableServerWebpackPlugin?: boolean;
2222
disableClientWebpackPlugin?: boolean;
@@ -26,10 +26,7 @@ export type NextConfigObject = {
2626
[key: string]: unknown;
2727
};
2828

29-
export type NextConfigFunction = (
30-
phase: string,
31-
defaults: { defaultConfig: { [key: string]: unknown } },
32-
) => NextConfigObject;
29+
export type NextConfigFunction = (phase: string, defaults: { defaultConfig: NextConfigObject }) => NextConfigObject;
3330

3431
/**
3532
* Webpack config
@@ -59,7 +56,7 @@ export type BuildContext = {
5956
isServer: boolean;
6057
buildId: string;
6158
dir: string;
62-
config: Partial<NextConfigObject>;
59+
config: NextConfigObject;
6360
webpack: { version: string };
6461
};
6562

packages/nextjs/src/config/webpack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export { SentryWebpackPlugin };
4545
* @returns The function to set as the nextjs config's `webpack` value
4646
*/
4747
export function constructWebpackConfigFunction(
48-
userNextConfig: NextConfigObject = {},
48+
userNextConfig: Partial<NextConfigObject> = {},
4949
userSentryWebpackPluginOptions: Partial<SentryWebpackPluginOptions> = {},
5050
): WebpackConfigFunction {
5151
// Will be called by nextjs and passed its default webpack configuration and context data about the build (whether

0 commit comments

Comments
 (0)