Skip to content

Commit 9f7909a

Browse files
authored
Merge pull request #279 from joshkel/ArrayBuffer-type
More specific data types - ArrayBuffer instead of ArrayBufferLike
2 parents f89aa92 + 4746c3d commit 9f7909a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Encoder.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ export class Encoder<ContextType = undefined> {
8484
private readonly forceIntegerToFloat: boolean;
8585

8686
private pos: number;
87-
private view: DataView;
88-
private bytes: Uint8Array;
87+
private view: DataView<ArrayBuffer>;
88+
private bytes: Uint8Array<ArrayBuffer>;
8989

9090
private entered = false;
9191

@@ -132,7 +132,7 @@ export class Encoder<ContextType = undefined> {
132132
*
133133
* @returns Encodes the object and returns a shared reference the encoder's internal buffer.
134134
*/
135-
public encodeSharedRef(object: unknown): Uint8Array {
135+
public encodeSharedRef(object: unknown): Uint8Array<ArrayBuffer> {
136136
if (this.entered) {
137137
const instance = this.clone();
138138
return instance.encodeSharedRef(object);
@@ -152,7 +152,7 @@ export class Encoder<ContextType = undefined> {
152152
/**
153153
* @returns Encodes the object and returns a copy of the encoder's internal buffer.
154154
*/
155-
public encode(object: unknown): Uint8Array {
155+
public encode(object: unknown): Uint8Array<ArrayBuffer> {
156156
if (this.entered) {
157157
const instance = this.clone();
158158
return instance.encode(object);

src/encode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type { SplitUndefined } from "./context.ts";
1111
export function encode<ContextType = undefined>(
1212
value: unknown,
1313
options?: EncoderOptions<SplitUndefined<ContextType>>,
14-
): Uint8Array {
14+
): Uint8Array<ArrayBuffer> {
1515
const encoder = new Encoder(options);
1616
return encoder.encodeSharedRef(value);
1717
}

0 commit comments

Comments
 (0)