rescript-compiler icon indicating copy to clipboard operation
rescript-compiler copied to clipboard

@unboxed should support Js.TypedArray2.ArrayBuffer.t

Open htoooth opened this issue 1 year ago • 1 comments

I found that @unboxed supports many types, but it does not support ArrayBuffer or TypedArray.

@unboxed
type dataType = Bin(Js_typed_array2.ArrayBuffer.t) | Json(Js.Json.t) | Text(string)
@unboxed
type dataType = Bin(Js_typed_array2.Uint8Array.t) | Json(Js.Json.t) | Text(string)

However, ArrayBuffer or TypedArray is a type supported by JavaScript.

When I process with record, the JSON data type errors again.

@unboxed
type dataType = Bin({ val: Js_typed_array2.Uint8Array.t}) | Json(Js.Json.t) | Text(string)

htoooth avatar May 15 '24 23:05 htoooth

I agree these, and probably many more builtins, should be supported by untagged variants. This will be much simpler after we move Core into the compiler, which is destined to happen in v12. Adding this to the v12 milestone.

zth avatar May 22 '24 11:05 zth