From a088c1c332c0061b72925a318ff69d0c48b71df6 Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Tue, 4 Feb 2025 12:26:59 +0000 Subject: [PATCH] refactor(next): improve type safety with Next.js types Replace generic Record types with proper Next.js types: - NextConfig for the config object - WebpackConfigContext for webpack options parameter --- packages/unplugin-typia/src/next.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/unplugin-typia/src/next.ts b/packages/unplugin-typia/src/next.ts index aad23572..02cf6364 100644 --- a/packages/unplugin-typia/src/next.ts +++ b/packages/unplugin-typia/src/next.ts @@ -4,6 +4,8 @@ * @module */ +import type { NextConfig } from 'next'; +import type { WebpackConfigContext } from 'next/dist/server/config-shared.js'; import webpack from './webpack.js'; import type { Options } from './core/options.js'; @@ -28,10 +30,10 @@ import type { Options } from './core/options.js'; * ); * ``` */ -function next(nextConfig: Record = {}, options: Options): Record { +function next(nextConfig: NextConfig = {}, options: Options): NextConfig { return { ...nextConfig, - webpack(config: Record, webpackOptions: Record) { + webpack(config: Record, webpackOptions: WebpackConfigContext) { if (Array.isArray(config?.plugins)) { config.plugins.unshift(webpack(options)); }