Skip to content

Commit 030d4f6

Browse files
ThatBlockyPenguinjsimpson
authored andcommitted
Update binary_reader.ts
Fixes error TS2729: Property 'buffer' is used before its initialization.
1 parent ace6429 commit 030d4f6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

binary_reader.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
export class BinaryReader {
2-
dataView = new DataView(
3-
this.buffer.buffer,
4-
this.buffer.byteOffset,
5-
this.buffer.byteLength,
6-
);
72
#position = 0;
3+
private dataView: DataView;
84

9-
constructor(private buffer: Uint8Array) {}
5+
constructor(private buffer: Uint8Array) {
6+
this.dataView = new DataView(
7+
this.buffer.buffer,
8+
this.buffer.byteOffset,
9+
this.buffer.byteLength,
10+
);
11+
}
1012

1113
/**
1214
* Rewinds the buffer/DataView byteOffset by numBytes bytes.

0 commit comments

Comments
 (0)