fix: correct numeric collection result types - #3696
Open
ryanchou1994 wants to merge 1 commit into
Open
ryanchou1994 wants to merge 1 commit into
ryanchou1994 wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
isNumeric([3, 4, 5])[0]works at runtime, but the declaration treats the result as a scalar type guard.hasNumericValuealso omits Matrix and nested-array results.This updates the collection overloads to return
MathArray<boolean>orMatrix<boolean>, including the existingisNumericchain method. Scalar inputs retain theisNumerictype guard; unknown, any, and scalar/collection unions return a boolean-or-collection union without incorrectly narrowing the input. Runtime behavior is unchanged.Related to #3380. This addresses the collection typing portion; the issue's broader boolean/Complex semantics and proposed scalar API remain separate.
Validation on macOS and Linux with Node 22:
The project's non-strict-null compiler mode infers direct null/undefined like any, so those calls conservatively retain a boolean-or-collection union. Strict-null mode returns boolean. An initial macOS run hit an existing CLI parallel-output ordering failure; its focused rerun and the final full run passed without changing CLI code or tests. Linux used the full gulp library build; the Git-history-based author update ran on macOS only. No generated output is included.