fix: make toBytes actually return the type it's typehint claims (#29313)

This commit is contained in:
Nico Schapeler 2022-12-20 07:43:53 +01:00 committed by GitHub
parent c8dd5bbd48
commit 0b479066b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -112,7 +112,8 @@ export class PublicKey extends Struct {
* Return the byte array representation of the public key in big endian
*/
toBytes(): Uint8Array {
return this.toBuffer();
const buf = this.toBuffer();
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
}
/**