mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 04:31:10 +00:00
fix(ci): restore array-safe record coercion
This commit is contained in:
@@ -7,8 +7,10 @@ describe("record-coerce", () => {
|
||||
it("keeps record coercion behavior for optional and nullable variants", () => {
|
||||
expect(asOptionalRecord({ ok: true })).toEqual({ ok: true });
|
||||
expect(asOptionalRecord(null)).toBeUndefined();
|
||||
expect(asOptionalRecord([{ ok: true }])).toBeUndefined();
|
||||
expect(asNullableRecord({ ok: true })).toEqual({ ok: true });
|
||||
expect(asNullableRecord(null)).toBeNull();
|
||||
expect(asNullableRecord([{ ok: true }])).toBeNull();
|
||||
});
|
||||
|
||||
it("stays isolated from utils.ts so browser bundles stay Node-free", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Keep this local so browser bundles do not pull in src/utils.ts and its Node-only side effects.
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return value !== null && typeof value === "object";
|
||||
return value !== null && typeof value === "object" && !Array.isArray(value);
|
||||
}
|
||||
|
||||
export function asRecord(value: unknown): Record<string, unknown> {
|
||||
|
||||
Reference in New Issue
Block a user