Skip to content

Conversation

@FlorianDenis
Copy link

@FlorianDenisFlorianDenis commented Mar 7, 2025

Make sure instances of Number as encoded as a number instead of a map.
I am encountering this issue in my current project, I believe this is a more sensible default behavior

All tests pass.

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.19%. Comparing base (59057ee) to head (b450e25).
Report is 3 commits behind head on main.

Files with missing linesPatch %Lines
src/Encoder.ts50.00%1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@ Coverage Diff @@## main #271 +/- ## ========================================== - Coverage 97.28% 97.19% -0.09%  ========================================== Files 17 17 Lines 1140 1142 +2 Branches 253 254 +1 ========================================== + Hits 1109 1110 +1 - Misses 31 32 +1 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gfx
Copy link
Member

gfx commented Mar 8, 2025

Why do you use the Number wrapper object? There's no reason to use it and it seems just a bug, in your project.

@FlorianDenis
Copy link
Author

I am not going to go too much into the details of my project because this is not the place, but it turns out that I have a need for representing a integer using an object instance rather than a primitive type, a need which Number was built into the language to fulfill. This is a deliberate choice, not a bug.

My goal with this PR is merely to point out that Number does exist today as a core part of the language (has since ES1, really), and so the question this poses here is:

  • Do we consider the MessagePack representation of it should be a map
  • Or do we consider it should be a int/float?

@FlorianDenis
Copy link
Author

@gfx Any thoughts on the above?

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@FlorianDenis@codecov-commenter@gfx