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); }