From 19ec046708b10b53fa4c667ffd4b14592b2e57b0 Mon Sep 17 00:00:00 2001 From: henz Date: Sat, 8 Aug 2026 08:01:50 +0800 Subject: [PATCH] fix(repeat): declare repeat()'s closure signature as ANY, not VOID DataType.VOID means "the associated JS value is undefined" (Python None), so Py2JS's type checker rejected any actual argument passed to a repeat()-composed closure - e.g. repeat(f, 5)(0) failed with "Expected argument 0 to have type 'NoneType', got 'int'". The closure is generic over its argument's type, so it should declare DataType.ANY, matching the existing pattern used for repl's identity- like closures. The bundle's own test suite didn't catch this because TestDataHandler.closure_call_unchecked calls the underlying JS function directly without validating declared argument types - only the real Py2JS evaluator enforces the signature. Fixes #896 --- src/bundles/repeat/src/functions.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bundles/repeat/src/functions.ts b/src/bundles/repeat/src/functions.ts index ac3bffa79e..8ee962b763 100644 --- a/src/bundles/repeat/src/functions.ts +++ b/src/bundles/repeat/src/functions.ts @@ -53,8 +53,8 @@ export async function* repeat(evaluator: IDataHandler, func: TypedValue