Version
23.1.0
Platform
22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000 arm64
Subsystem
node:v8
What steps will reproduce the bug?
import { serialize } from "node:v8";
const float16Data = new Float16Array([1.0, 2.5, 3.14]);
try {
const serialized = serialize(float16Data);
console.log("Serialization successful!");
console.log("Serialized data:", serialized);
} catch (error) {
console.error("Serialization failed:", error.message);
}
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
serialize calls finishes successfuly.
What do you see instead?
const float16Data = new Float16Array([1.0, 2.5, 3.14]);
^
ReferenceError: Float16Array is not defined
at file:///Users/ib/dev/deno/index.js:3:21
Additional information
While I understand that Float16Array is not yet supported (eg. #52416) as it requires upgrade to V8 12.4, maybe there's a chance we could agree that arrayBufferViewTypeToIndex will return 13 for the Float16Array?
|
function arrayBufferViewTypeToIndex(abView) { |
|
const type = ObjectPrototypeToString(abView); |
|
if (type === '[object Int8Array]') return 0; |
|
if (type === '[object Uint8Array]') return 1; |
|
if (type === '[object Uint8ClampedArray]') return 2; |
|
if (type === '[object Int16Array]') return 3; |
|
if (type === '[object Uint16Array]') return 4; |
|
if (type === '[object Int32Array]') return 5; |
|
if (type === '[object Uint32Array]') return 6; |
|
if (type === '[object Float32Array]') return 7; |
|
if (type === '[object Float64Array]') return 8; |
|
if (type === '[object DataView]') return 9; |
|
// Index 10 is FastBuffer. |
|
if (type === '[object BigInt64Array]') return 11; |
|
if (type === '[object BigUint64Array]') return 12; |
|
return -1; |
|
} |
Thanks!
Version
23.1.0
Platform
Subsystem
node:v8
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
serializecalls finishes successfuly.What do you see instead?
Additional information
While I understand that
Float16Arrayis not yet supported (eg. #52416) as it requires upgrade to V8 12.4, maybe there's a chance we could agree thatarrayBufferViewTypeToIndexwill return13for theFloat16Array?node/lib/v8.js
Lines 277 to 293 in 5633c62
Thanks!