dfinity / agent-js

A collection of libraries and tools for building software around the Internet Computer, in JavaScript.
https://agent-js.icp.xyz
Apache License 2.0
155 stars 96 forks source link

TypeScript return type inconsistency for IDL.encode #950

Open bdemann opened 3 weeks ago

bdemann commented 3 weeks ago

Describe the bug The return type of IDL.encode is specified to be an ArrayBuffer but at run time it is actually a Uint8Array.

const result = IDL.encode([IDL.Text], ["hello"]);

console.log(result instanceof Uint8Array); // true console.log(result instanceof ArrayBuffer); // false console.log(result); // shows a Uint8Array