gleam
gleam copied to clipboard
Can't use a package with bit array segment on JS even if it is only used within the Erlang target
Reproducible Code:
import gleam/io
import gleam/bit_array
import gleam/crypto
pub fn main() {
io.debug(sign_message)
}
@external(javascript, "./ffi.mjs", "signMessage")
fn sign_message() -> String {
let message = bit_array.from_string("foo")
let key = bit_array.from_string("bar")
crypto.sign_message(message, key, crypto.Sha256)
}
Output:
$ gleam check --target=js
error: Unsupported feature for compilation target
┌─ reproduce_error/build/packages/gleam_crypto/src/gleam/crypto.gleam:48:10
│
48 │ <<x, left:bits>>, <<y, right:bits>> -> {
│ ^^^^^^^^^
This bit array segment option in patterns is not supported for JavaScript compilation.
Thank you