This is an automated email from the ASF dual-hosted git repository.
shunping pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 1fc615fcd2b [typescript] - fix typescript failures (#40635)
1fc615fcd2b is described below
commit 1fc615fcd2b35b82a9b15bb3b260c989a7a64511
Author: Derrick Williams <[email protected]>
AuthorDate: Fri Oct 16 14:09:36 2026 -0400
[typescript] - fix typescript failures (#40635)
* [typescript] - fix typescript failures
* fix test call
---
sdks/typescript/src/apache_beam/internal/serialize.ts | 2 +-
sdks/typescript/src/apache_beam/serialization.ts | 17 +++++++++++++++--
sdks/typescript/test/primitives_test.ts | 6 ++----
3 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/sdks/typescript/src/apache_beam/internal/serialize.ts
b/sdks/typescript/src/apache_beam/internal/serialize.ts
index 6584e41d6af..29f474ef485 100644
--- a/sdks/typescript/src/apache_beam/internal/serialize.ts
+++ b/sdks/typescript/src/apache_beam/internal/serialize.ts
@@ -16,10 +16,10 @@
* limitations under the License.
*/
+import { requireForSerialization, registeredObjects } from "../serialization";
import * as serialize_closures from "serialize-closures";
import Long from "long";
-import { requireForSerialization, registeredObjects } from "../serialization";
import { packageName } from "../utils/packageJson";
const BIGINT_PREFIX = ":bigint:";
diff --git a/sdks/typescript/src/apache_beam/serialization.ts
b/sdks/typescript/src/apache_beam/serialization.ts
index 9ca2177926f..1c7ce53ca64 100644
--- a/sdks/typescript/src/apache_beam/serialization.ts
+++ b/sdks/typescript/src/apache_beam/serialization.ts
@@ -16,10 +16,23 @@
* limitations under the License.
*/
-import * as serialize_closures from "serialize-closures";
+// Polyfill deprecated util helpers removed in Node 24+ that are still used by
+// serialize-closures.
+const nodeUtil = require("util");
+if (typeof nodeUtil.isPrimitive !== "function") {
+ nodeUtil.isPrimitive = (val: unknown): boolean =>
+ val === null || (typeof val !== "object" && typeof val !== "function");
+}
+if (typeof nodeUtil.isArray !== "function") {
+ nodeUtil.isArray = Array.isArray;
+}
+if (typeof nodeUtil.isFunction !== "function") {
+ nodeUtil.isFunction = (val: unknown): boolean => typeof val === "function";
+}
const registeredModules: string[] = [];
-export const registeredObjects: serialize_closures.BuiltinRecord[] = [];
+export const registeredObjects: import("serialize-closures").BuiltinRecord[] =
+ [];
const registeredObjectSet: Set<any> = new Set();
/**
diff --git a/sdks/typescript/test/primitives_test.ts
b/sdks/typescript/test/primitives_test.ts
index b3f35cce1fb..b7adb28d9f0 100644
--- a/sdks/typescript/test/primitives_test.ts
+++ b/sdks/typescript/test/primitives_test.ts
@@ -308,10 +308,8 @@ export function suite(runner: beam.Runner =
directRunner()) {
return v * 4;
});
- assert.deepEqual(
- p.context.getPCollectionCoder(res),
- new GeneralObjectCoder()
- );
+ const coder = p.context.getPCollectionCoder(res);
+ assert.equal(coder.constructor.name, "GeneralObjectCoder");
});
// why doesn't map need types here?
it("runs a GroupBy expansion", function () {