diff --git a/index.spec.tsx b/index.spec.tsx
index fb09a78..936c52e 100644
--- a/index.spec.tsx
+++ b/index.spec.tsx
@@ -56,6 +56,44 @@ test("simple children", function (t) {
);
});
+test("bigint children", function (t) {
+ t.plan(4);
+
+ const { container } = render(
+ {
+ t.equal(result.length, 4, "array length");
+
+ t.equal(isElement(result[0]) && result[0].key, ".0", "0th element key");
+ t.equal(result[1], 10n, "1st bigint child");
+ t.equal(result[3], BigInt(20), "3rd BigInt() child");
+ }}
+ >
+ one
+ {10n}
+ two
+ {BigInt(20)}
+
+ );
+});
+
+test("bigint in nested fragments", function (t) {
+ t.plan(2);
+
+ const { container } = render(
+ {
+ t.equal(result.length, 1, "array length");
+ t.equal(result[0], 100n, "nested bigint preserved");
+ }}
+ >
+ <>
+ <>{100n}>
+ >
+
+ );
+});
+
test("nested arrays and fragments with mixed content", function (t) {
t.plan(2);
diff --git a/index.ts b/index.ts
index 6e06000..58475af 100644
--- a/index.ts
+++ b/index.ts
@@ -37,7 +37,11 @@ export default function flattenChildren(
key: keys.concat(String(node.key)).join("."),
})
);
- } else if (typeof node === "string" || typeof node === "number") {
+ } else if (
+ typeof node === "string" ||
+ typeof node === "number" ||
+ typeof node === "bigint"
+ ) {
acc.push(node);
}
}