From 0b6742c058b7e75fe01c34b29180937e7126bbd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Sat, 18 Mar 2023 14:56:28 +0800 Subject: [PATCH] refactor: improve webpack loader type --- src/webpack/loaders/transform.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/webpack/loaders/transform.ts b/src/webpack/loaders/transform.ts index 9278bbde..e674df2c 100644 --- a/src/webpack/loaders/transform.ts +++ b/src/webpack/loaders/transform.ts @@ -2,13 +2,13 @@ import type { LoaderContext } from 'webpack' import type { UnpluginContext } from '../../types' import { createContext } from '../context' -export default async function transform(this: LoaderContext, source: string, map: any) { +export default async function transform(this: LoaderContext<{ unpluginName: string }>, source: string, map: any) { const callback = this.async() - let unpluginName + let unpluginName: string if (typeof this.query === 'string') { const query = new URLSearchParams(this.query) - unpluginName = query.get('unpluginName') + unpluginName = query.get('unpluginName')! } else { unpluginName = this.query.unpluginName