From db81b708ae47be56d9939ce9220381d57c779bfe Mon Sep 17 00:00:00 2001 From: mrkishi Date: Fri, 20 Mar 2026 18:21:00 -0300 Subject: [PATCH] feat: whitelist `Float16Array` --- .changeset/common-ducks-agree.md | 5 +++++ src/parse.js | 1 + src/stringify.js | 1 + src/types.d.ts | 2 +- src/uneval.js | 2 ++ 5 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changeset/common-ducks-agree.md diff --git a/.changeset/common-ducks-agree.md b/.changeset/common-ducks-agree.md new file mode 100644 index 0000000..949b326 --- /dev/null +++ b/.changeset/common-ducks-agree.md @@ -0,0 +1,5 @@ +--- +"devalue": minor +--- + +feat: whitelist `Float16Array` diff --git a/src/parse.js b/src/parse.js index 25d667d..8085948 100644 --- a/src/parse.js +++ b/src/parse.js @@ -148,6 +148,7 @@ export function unflatten(parsed, revivers) { case 'Uint8ClampedArray': case 'Int16Array': case 'Uint16Array': + case 'Float16Array': case 'Int32Array': case 'Uint32Array': case 'Float32Array': diff --git a/src/stringify.js b/src/stringify.js index 780644c..a3e78fb 100644 --- a/src/stringify.js +++ b/src/stringify.js @@ -220,6 +220,7 @@ export function stringify(value, reducers) { case 'Uint8ClampedArray': case 'Int16Array': case 'Uint16Array': + case 'Float16Array': case 'Int32Array': case 'Uint32Array': case 'Float32Array': diff --git a/src/types.d.ts b/src/types.d.ts index 5a2019f..fe4f174 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -1 +1 @@ -export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array; \ No newline at end of file +export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Float16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array; diff --git a/src/uneval.js b/src/uneval.js index 7da1730..a6143d2 100644 --- a/src/uneval.js +++ b/src/uneval.js @@ -91,6 +91,7 @@ export function uneval(value, replacer) { case 'Uint8ClampedArray': case 'Int16Array': case 'Uint16Array': + case 'Float16Array': case 'Int32Array': case 'Uint32Array': case 'Float32Array': @@ -289,6 +290,7 @@ export function uneval(value, replacer) { case 'Uint8ClampedArray': case 'Int16Array': case 'Uint16Array': + case 'Float16Array': case 'Int32Array': case 'Uint32Array': case 'Float32Array':