fix: be specific about returned backing array#183
Conversation
Since `ArrayBuffer` and `SharedArrayBuffer` types diverged, some APIs require `Uint8Array<ArrayBuffer>` which makes it incompatible with the default `Uint8Array` (e.g. `Uint8Array<ArrayBufferLike>`, e.g. `Uint8Array<ArrayBuffer | SharedArrayBuffer>`) so update the return type of `encode` to make clear what type of backing buffer is used. This means that onward code doesn't need to check the backing type.
3c399df to
e233f99
Compare
|
Would you mind just limiting this to the json path? Narrowing the various I think we might be able to achieve what you want with some generics hackery, make |
|
@achingbrain see if #184 does what you want, I think it solves for both situations |
|
Fair enough, completely agree on keeping #184 looks good to me. |
Since
ArrayBufferandSharedArrayBuffertypes diverged, some APIs requireUint8Array<ArrayBuffer>which makes it incompatible with the defaultUint8Array(e.g.Uint8Array<ArrayBufferLike>, e.g.Uint8Array<ArrayBuffer | SharedArrayBuffer>) so update the return type ofencodeto make clear what type of backing buffer is used.This means that onward code doesn't need to check the backing type.