Skip to content

Commit 87a3bca

Browse files
refactor: ArrayBuffer
error TS2322: Type 'Buffer<ArrayBufferLike>' is not assignable to type 'ArrayBuffer'.
1 parent bba494b commit 87a3bca

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

packages/core/src/interaction-output.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ export class InteractionOutput implements WoT.InteractionOutput {
7575

7676
const data = await this.#content.toBuffer();
7777
this.dataUsed = true;
78-
this.#buffer = data;
78+
// this.#buffer = new Uint8Array(data).buffer
79+
this.#buffer = data as unknown as ArrayBuffer;
7980

80-
return data;
81+
return this.#buffer;
8182
}
8283

8384
async value<T extends WoT.DataSchemaValue>(): Promise<T> {
@@ -120,7 +121,8 @@ export class InteractionOutput implements WoT.InteractionOutput {
120121
// read fully the stream
121122
const bytes = await this.#content.toBuffer();
122123
this.dataUsed = true;
123-
this.#buffer = bytes;
124+
// this.#buffer = new Uint8Array(bytes).buffer;
125+
this.#buffer = bytes as unknown as ArrayBuffer;
124126

125127
const json = ContentSerdes.get().contentToValue({ type: this.#content.type, body: bytes }, this.schema);
126128

0 commit comments

Comments
 (0)