From 44cd30b23ab783399877cd911e66ab8c00ade302 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Fri, 19 Jul 2024 20:45:01 +0200 Subject: [PATCH] fix types --- scripts/utils.mts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/utils.mts b/scripts/utils.mts index 5b84c9878..2027bed28 100644 --- a/scripts/utils.mts +++ b/scripts/utils.mts @@ -16,15 +16,11 @@ * along with this program. If not, see . */ -/** - * @param {string} filePath - * @returns {string | null} - */ -export function getPluginTarget(filePath) { +export function getPluginTarget(filePath: string) { const pathParts = filePath.split(/[/\\]/); - if (/^index\.tsx?$/.test(pathParts.at(-1))) pathParts.pop(); + if (/^index\.tsx?$/.test(pathParts.at(-1)!)) pathParts.pop(); - const identifier = pathParts.at(-1).replace(/\.tsx?$/, ""); + const identifier = pathParts.at(-1)!.replace(/\.tsx?$/, ""); const identiferBits = identifier.split("."); return identiferBits.length === 1 ? null : identiferBits.at(-1); }