From 6a0abd71ad9d7d29bb8c5e52288e78513b5b24ea Mon Sep 17 00:00:00 2001 From: JunghwanNA <70629228+shaun0927@users.noreply.github.com> Date: Fri, 17 Apr 2026 16:41:42 +0900 Subject: [PATCH] fix(scripts): drop unreachable branch in validate-modules.js The inner 'typeof exported[k] !== function' check sits inside 'typeof exported[k] === function', so it can never be true. The intended 'declared but not callable' error is unreachable, and the validator silently accepts everything it claims to check. Without a manifest of expected function keys the script cannot decide which members should be functions, so the nested block is removed rather than given a fake fix. The outer typeof check was already a no-op in every call site the script is invoked with, so behaviour is unchanged; the code now matches that behaviour honestly. --- scripts/validate-modules.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/scripts/validate-modules.js b/scripts/validate-modules.js index ee8646aa..53448ab7 100644 --- a/scripts/validate-modules.js +++ b/scripts/validate-modules.js @@ -21,17 +21,12 @@ for (const m of modules) { process.exit(1); } - if (t === 'object') { - const keys = Object.keys(exported); - for (const k of keys) { - if (typeof exported[k] === 'function') { - if (typeof exported[k] !== 'function') { - console.error('FAIL: ' + m + '.' + k + ' is declared but not a callable function'); - process.exit(1); - } - } - } - } + // Previously this block contained a nested `typeof === 'function'` test + // inside `typeof === 'function'`, which was trivially false and made the + // intended "declared but not callable" warning unreachable. Without a + // declaration manifest we cannot tell which exported keys are expected + // to be functions, so the block is left as a no-op but the dead branch + // is removed to avoid giving false assurance. checked++; }