Skip to content

fix: correct numeric collection result types - #3696

Open
ryanchou1994 wants to merge 1 commit into
josdejong:developfrom
ryanchou1994:fix/numeric-collection-types
Open

ryanchou1994 wants to merge 1 commit into
josdejong:developfrom
ryanchou1994:fix/numeric-collection-types

Conversation

@ryanchou1994

Copy link
Copy Markdown

isNumeric([3, 4, 5])[0] works at runtime, but the declaration treats the result as a scalar type guard. hasNumericValue also omits Matrix and nested-array results.

This updates the collection overloads to return MathArray<boolean> or Matrix<boolean>, including the existing isNumeric chain method. Scalar inputs retain the isNumeric type 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 new TypeScript regressions produce 22 diagnostics against the original declarations and pass with this patch, including runtime assertions for arrays, matrices, and chains.
  • Complete source tests: 6,652 passing, 22 pending on each platform; generated tests: 36 passing; Node tests: 282 passing on macOS and 295 on Linux.
  • Project TypeScript compile/runtime tests, separate strict-null checks, lint, formatting, and library builds pass.

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.

Copilot AI lite review requested due to automatic review settings September 9, 2026 17:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
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