Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/bun-types/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ interface ArrayBuffer {
/**
* Resize an ArrayBuffer in-place.
*/
resize(byteLength: number): ArrayBuffer;
resize(byteLength: number): void;

/**
* Returns a section of an ArrayBuffer.
Expand Down
5 changes: 5 additions & 0 deletions test/integration/bun-types/fixture/array-buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ const buffer = new ArrayBuffer(1024, {
console.log(buffer.byteLength); // 1024
buffer.resize(2048);
console.log(buffer.byteLength); // 2048

// resize() mutates the buffer in place and returns undefined (void) per the
// ECMAScript spec, not the ArrayBuffer.
const resizeResult: void = buffer.resize(1024);
void resizeResult;
TextDecoder;

const buf = new SharedArrayBuffer(1024);
Expand Down