Skip to content

fix: infer input ndarray type in ndarray/some-by assign overloads#12627

Draft
Planeshifter wants to merge 1 commit into
developfrom
philipp/fix-ndarray-some-by-assign-generic
Draft

fix: infer input ndarray type in ndarray/some-by assign overloads#12627
Planeshifter wants to merge 1 commit into
developfrom
philipp/fix-ndarray-some-by-assign-generic

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • types the input as x: U in both some-by.assign overloads of the @stdlib/ndarray/some-by declaration, so the input element type is inferred. Previously the input was typed x: ndarray, preventing inference and degrading the predicate argument to Predicate<unknown, ...>. This matches the non-assign overloads and the sibling any-by/every-by packages. Existing $ExpectType boolndarray assertions are unaffected.

Related Issues

Does this pull request have any related issues?

No.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request?

Found during a TypeScript-declaration audit of the ndarray namespace.

Checklist

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

These changes were identified by a Claude Code audit of the ndarray namespace's TypeScript declarations and applied with Claude Code assistance; the changes were reviewed by myself.


@stdlib-js/reviewers

Both `assign` overloads typed the input as `x: ndarray` instead of
`x: U`, so the `T`/`U` type parameters could not be inferred and the
`predicate` argument degraded to `Predicate<unknown, ...>`. Type the
input as `x: U`, matching the non-assign overloads and the sibling
`any-by`/`every-by` packages.

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: passed
  - task: lint_license_headers
    status: passed
---
@stdlib-bot
Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
ndarray/some-by $\color{green}593/593$
$\color{green}+100.00\%$
$\color{green}80/80$
$\color{green}+100.00\%$
$\color{green}3/3$
$\color{green}+100.00\%$
$\color{green}593/593$
$\color{green}+100.00\%$

The above coverage report was generated for the changes in this PR.

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