Skip to content

Conversation

@ayushman1210
Copy link

I've fixed the bug where [min()]and [max()](with [Infinity] or [-Infinity]throw friendly errors in [p5.js} 2.0.4+

Changes Made

  • Updated the [isNumber()] helper to properly recognize [Infinity] and [-Infinity]as valid numbers
  • Now accepts both numeric [Infinity][-Infinity]and string forms like ["Infinity"]
  • This prevents the FES (Friendly Error System) from incorrectly flagging them as wrong types

Added test cases (
Added 3 tests for [max()] and [min()]with Infinity values
These tests ensure the fix works and prevents regression

@ayushman1210
Copy link
Author

Hi maintainer @perminder-17 please review this pr for the issue #8104
thanks

Copy link
Collaborator

@perminder-17 perminder-17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I don't think we have error here in our 1.x branch. For fixing this issue, you need to fix that in dev-2.0 branch (2.x) versions.

You need to update it something like: z.number().or(z.literal(Infinity)).or(z.literal(-Infinity));

and after that, you'll see the tests are breaking after the changes, you should refer to this solution then: #8109 (review) and make the tests pass.

@ayushman1210
Copy link
Author

Hi @perminder-17
Thanks for the clarification
i will update it in Dev-2.0 soon

Sign up for free to 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.

2 participants