From 6b74b1e81161c39c95b6755954252862dd03ab19 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 6 Oct 2022 19:16:13 +0000 Subject: [PATCH] [TS] Correct encodeUint64Array array view length Otherwise the `set` call fails as the array view we've constructed is only 1 element long. --- typescript_strings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typescript_strings.py b/typescript_strings.py index 84dd9a15..ee4e7094 100644 --- a/typescript_strings.py +++ b/typescript_strings.py @@ -187,9 +187,9 @@ export function encodeUint32Array (inputArray: Uint32Array|Array): numbe /* @internal */ export function encodeUint64Array (inputArray: BigUint64Array|Array): number { const cArrayPointer = wasm.TS_malloc((inputArray.length + 1) * 8); - const arrayMemoryView = new BigUint64Array(wasm.memory.buffer, cArrayPointer, 1); - arrayMemoryView.set(inputArray, 1); + const arrayMemoryView = new BigUint64Array(wasm.memory.buffer, cArrayPointer, inputArray.length + 1); arrayMemoryView[0] = BigInt(inputArray.length); + arrayMemoryView.set(inputArray, 1); return cArrayPointer; } -- 2.39.5