Skip to content
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

Linter complaints when using big endian IO #15

Closed
UlrichEckhardt opened this issue Jul 18, 2024 · 3 comments · Fixed by #17
Closed

Linter complaints when using big endian IO #15

UlrichEckhardt opened this issue Jul 18, 2024 · 3 comments · Fixed by #17
Assignees
Labels
bug Something isn't working

Comments

@UlrichEckhardt
Copy link

Heya!

Following code is criticized by my linter:

const writer = new BufferWriter(buffer, { endianness: 'big' });
const reader = new BufferReader(buffer, { endianness: 'big' });

Its complaint is:

Argument of type '{ endianness: "big"; }' is not assignable to parameter of type 'BufferIOOptions'.
Property 'byteOffset' is missing in type '{ endianness: "big"; }' but required in type 'BufferIOOptions'.ts(2345)

Without testing it extensively, this seems to resolve the issue:

diff --git a/src/io/bufferIOBase.ts b/src/io/bufferIOBase.ts
index 9da3e85..9e54a0a 100644
--- a/src/io/bufferIOBase.ts
+++ b/src/io/bufferIOBase.ts
@@ -5,11 +5,11 @@ export type BufferIOOptions = {
   /**
    * @default 0
    */
-  byteOffset: number;
+  byteOffset?: number;
   /**
    * @default 'system'
    */
-  endianness: Endianness | 'system';
+  endianness?: Endianness | 'system';
 };

Thanks for your effort!

Uli

@iwoplaza iwoplaza self-assigned this Jul 18, 2024
@iwoplaza
Copy link
Owner

Thank you for the issue report!
I will promptly look into it and add test coverage for this.

@iwoplaza iwoplaza added the bug Something isn't working label Jul 18, 2024
@iwoplaza iwoplaza linked a pull request Jul 18, 2024 that will close this issue
@iwoplaza iwoplaza modified the milestone: 4.1.0 Jul 18, 2024
@iwoplaza
Copy link
Owner

@UlrichEckhardt Just made a PR that addresses this issue, let me know if the test cases cover the issues you had with the library. #17

@iwoplaza
Copy link
Owner

Fix released as part of version 4.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants