From 0a810fa81a303f01ac4f9806316c3cd374084918 Mon Sep 17 00:00:00 2001 From: Stefan Probst Date: Fri, 1 Jul 2022 07:21:10 +0200 Subject: [PATCH 1/3] chore: fix bundle-analyzer types --- packages/next-bundle-analyzer/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/next-bundle-analyzer/index.d.ts b/packages/next-bundle-analyzer/index.d.ts index 46d7ca853d3ca..5a97ee9b5be4b 100644 --- a/packages/next-bundle-analyzer/index.d.ts +++ b/packages/next-bundle-analyzer/index.d.ts @@ -1,8 +1,8 @@ import type { NextConfig } from 'next' -type NextBundleAnalyzer = (options?: { - enabled?: boolean - openAnalyzer?: boolean -}) => (config?: NextConfig) => NextConfig +declare const NextBundleAnalyzer = + (options?: { enabled?: boolean; openAnalyzer?: boolean }) => + (config?: NextConfig) => + NextConfig export = NextBundleAnalyzer From 1ee5bee3c2791910e8950378cccf0df65f6af854 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Sun, 10 Jul 2022 13:16:20 -0500 Subject: [PATCH 2/3] Add test for bundle analyzer type --- test/production/typescript-basic/app/server.ts | 4 ++++ test/production/typescript-basic/index.test.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/test/production/typescript-basic/app/server.ts b/test/production/typescript-basic/app/server.ts index 2e0ec7fd97fd9..3a4b0a49d5feb 100644 --- a/test/production/typescript-basic/app/server.ts +++ b/test/production/typescript-basic/app/server.ts @@ -1,4 +1,8 @@ import next from 'next' +import bundleAnalyzer from '@next/bundle-analyzer' + +const config = bundleAnalyzer({}) + const app = next({ dir: '.', dev: process.env.NODE_ENV !== 'production', diff --git a/test/production/typescript-basic/index.test.ts b/test/production/typescript-basic/index.test.ts index 4af5357f612c5..dd79355efbf3c 100644 --- a/test/production/typescript-basic/index.test.ts +++ b/test/production/typescript-basic/index.test.ts @@ -10,6 +10,7 @@ describe('TypeScript basic', () => { next = await createNext({ files: new FileRef(path.join(__dirname, 'app')), dependencies: { + '@next/bundle-analyzer': 'canary', typescript: 'latest', '@types/node': 'latest', '@types/react': 'latest', From 4206e3007b5090c835a8f65a965d605ba46d9144 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Sun, 10 Jul 2022 13:30:31 -0500 Subject: [PATCH 3/3] fix lint --- test/production/typescript-basic/app/server.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/test/production/typescript-basic/app/server.ts b/test/production/typescript-basic/app/server.ts index 3a4b0a49d5feb..37051eea302a1 100644 --- a/test/production/typescript-basic/app/server.ts +++ b/test/production/typescript-basic/app/server.ts @@ -1,6 +1,7 @@ import next from 'next' import bundleAnalyzer from '@next/bundle-analyzer' +// eslint-disable-next-line const config = bundleAnalyzer({}) const app = next({