Skip to content

More specific data types - ArrayBuffer instead of ArrayBufferLike #279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions src/Encoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ export class Encoder<ContextType = undefined> {
private readonly forceIntegerToFloat: boolean;

private pos: number;
private view: DataView;
private bytes: Uint8Array;
private view: DataView<ArrayBuffer>;
private bytes: Uint8Array<ArrayBuffer>;

private entered = false;

Expand Down Expand Up @@ -132,7 +132,7 @@ export class Encoder<ContextType = undefined> {
*
* @returns Encodes the object and returns a shared reference the encoder's internal buffer.
*/
public encodeSharedRef(object: unknown): Uint8Array {
public encodeSharedRef(object: unknown): Uint8Array<ArrayBuffer> {
if (this.entered) {
const instance = this.clone();
return instance.encodeSharedRef(object);
Expand All @@ -152,7 +152,7 @@ export class Encoder<ContextType = undefined> {
/**
* @returns Encodes the object and returns a copy of the encoder's internal buffer.
*/
public encode(object: unknown): Uint8Array {
public encode(object: unknown): Uint8Array<ArrayBuffer> {
if (this.entered) {
const instance = this.clone();
return instance.encode(object);
Expand Down
2 changes: 1 addition & 1 deletion src/encode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { SplitUndefined } from "./context.ts";
export function encode<ContextType = undefined>(
value: unknown,
options?: EncoderOptions<SplitUndefined<ContextType>>,
): Uint8Array {
): Uint8Array<ArrayBuffer> {
const encoder = new Encoder(options);
return encoder.encodeSharedRef(value);
}