From cad8c92128352a4ff4d0bea1dada2eebcb2906b3 Mon Sep 17 00:00:00 2001 From: jaydenfyi <213395523+jaydenfyi@users.noreply.github.com> Date: Sun, 25 Jan 2026 10:46:24 +0800 Subject: [PATCH] no mutation --- extensions/twitch/src/actions.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/extensions/twitch/src/actions.ts b/extensions/twitch/src/actions.ts index ca93a7003..7f4ad63d4 100644 --- a/extensions/twitch/src/actions.ts +++ b/extensions/twitch/src/actions.ts @@ -45,15 +45,16 @@ function readStringParam( } // Convert value to string safely - let str: string; if (typeof value === "string") { - str = value; - } else if (typeof value === "number" || typeof value === "boolean") { - str = String(value); - } else { - throw new Error(`Parameter ${key} must be a string, number, or boolean`); + return options.trim !== false ? value.trim() : value; } - return options.trim !== false ? str.trim() : str; + + if (typeof value === "number" || typeof value === "boolean") { + const str = String(value); + return options.trim !== false ? str.trim() : str; + } + + throw new Error(`Parameter ${key} must be a string, number, or boolean`); } /** Supported Twitch actions */