You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It returns a Buffer, but when I call encode() in a browser, I get a Uint8Array instead:
This means that when you use it in TypeScript, I get an error when trying to type it as Uint8Array:
Type casting as workaround seems to resolve compile time issue:
// Note: The types for cbor-x are incorrect here, as encode() actually// returns a Uint8Array in the browser. Cast to fix the type error.constdata=<Uint8Array>(encode(message)asunknown);
The text was updated successfully, but these errors were encountered:
Hi there! Thanks for this wonderful library. Just wanted to report what appears to be an inaccuracy in the type annotation for
encode()
:cbor-x/index.d.ts
Lines 61 to 63 in f531383
It returns a
Buffer
, but when I callencode()
in a browser, I get a Uint8Array instead:This means that when you use it in TypeScript, I get an error when trying to type it as Uint8Array:
Type casting as workaround seems to resolve compile time issue:
The text was updated successfully, but these errors were encountered: