Skip to content

Commit 4931ae0

Browse files
committed
test valueof (null, ()=>{})
1 parent eec5272 commit 4931ae0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/array/valueof-test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ it("valueof reads arrays", () => {
3535
valueof(new Set(["1", 2, 3]), (d: unknown) => +(d as number), Float32Array);
3636
});
3737

38+
it("valueof does not crash on non iterable values with an accessor", () => {
39+
for (const n of [null, undefined])
40+
assert.strictEqual(
41+
valueof(n, () => 1),
42+
n
43+
);
44+
});
45+
3846
/*
3947
4048
// field names are inferred

0 commit comments

Comments
 (0)