Skip to content

refactor: align TypeScript declarations across stats packages#12512

Merged
kgryte merged 4 commits into
developfrom
philipp/fix-propagation-2026-06-03
Jun 5, 2026
Merged

refactor: align TypeScript declarations across stats packages#12512
kgryte merged 4 commits into
developfrom
philipp/fix-propagation-2026-06-03

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

Description

Propagating fixes merged to develop between 2026-06-02 20:44 CDT and 2026-06-03 04:40 PDT to sibling packages.

Each commit on this branch corresponds to one source fix pattern and applies the equivalent change to every sibling that exhibited the same defect after independent validation.

`refactor: use offsetX parameter name in ``strided/meanwd``` (commit 563cadc)

Source: 75630151 ("refactor: use offsetX parameter name in strided/nanrange"). The meanwd TypeScript declaration's ndarray signature and its JSDoc still referred to the starting-index argument as offset rather than the namespace-wide offsetX convention used by the implementation and by sibling strided routines. Renamed both the @param tag and the parameter in the signature.

  • @stdlib/stats/strided/meanwd

`refactor: remove unused generics across ``stats/base/ndarray/*``` (commit 09eafa3)

Sources: 056a0802 ("refactor: remove unused generics") and e8a15dd0 ("refactor: remove unused generic in stats/base/ndarray/minsorted"). Each of the sibling declarations introduced T extends typedndarray<number> = typedndarray<number> and used T only inside the input array tuple — never in the return type, never in any constraint. The generic added indirection without expressing a relationship, so it has been removed and typedndarray<number> substituted in place.

  • @stdlib/stats/base/ndarray/dmeanstdev
  • @stdlib/stats/base/ndarray/dnanstdev
  • @stdlib/stats/base/ndarray/dnanstdevch
  • @stdlib/stats/base/ndarray/dnanstdevpn
  • @stdlib/stats/base/ndarray/sstdev
  • @stdlib/stats/base/ndarray/sstdevch
  • @stdlib/stats/base/ndarray/sstdevpn
  • @stdlib/stats/base/ndarray/sstdevtk
  • @stdlib/stats/base/ndarray/sstdevwd
  • @stdlib/stats/base/ndarray/sstdevyc

`refactor: align parameter name with implementation in ``stats/incr/*``` (commit 8f2798b)

Source: 9ee909b1 ("refactor: align parameter name with implementation in incr/nanstdev"). The TypeScript declarations exposed the optional first argument as mu, while the JavaScript implementations in lib/main.js consistently bind the parameter to mean. The declarations have been brought into alignment with the implementations so that downstream consumers see the same name the runtime exposes.

  • @stdlib/stats/incr/variance
  • @stdlib/stats/incr/nanvariance
  • @stdlib/stats/incr/stdev

Related Issues

This pull request has no related issues.

Questions

No.

Other

Validation

Search scope was restricted per source pattern: lib/node_modules/@stdlib/stats/strided/*/docs/types/index.d.ts for the strided rename; lib/node_modules/@stdlib/stats/base/ndarray/*/docs/types/index.d.ts for the unused-generic removal; and lib/node_modules/@stdlib/stats/incr/*/docs/types/index.d.ts for the mumean alignment, with the actual JavaScript implementation in each package's lib/main.js consulted to confirm the misalignment.

Every candidate site was independently confirmed by two validation passes that read the full file (rejecting any site where surrounding context would change semantics), an adaptation pass that produced the exact patch, and a style-consistency pass that compared the patches against the already-fixed source declarations. Only sites that survived all four passes appear in this PR.

Deliberately excluded:

  • stats/base/ndarray/cumax and cumin: the generic T is used in the return type, so removal would be a behavior change.
  • PascalCase interface renames bundled in 6a45ff78 ("fix: broaden parameter types in @stdlib/assert/is-negative-finite"): the source commit's primary intent was widening parameter types — package-specific — and the incidental rename portion is more refactor: than fix:, so it does not cleanly propagate from that commit.
  • Per-distribution parameter renames (logistic/weibull/levy): each distribution has its own canonical parameter naming, so the propagation would require per-package interpretation rather than a mechanical rule.
  • TSDoc text corrections in math/iter and math/base/tools: each commit corrected a unique error per file with no clear sibling pattern.

Checklist

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

This PR was produced by an automated fix-propagation routine driven by Claude Code: source commits merged to develop in the prior 24 hours were filtered to those describing generalizable defects, candidate sibling sites were enumerated by ripgrep searches scoped to each pattern's namespace, and four independent agent passes (two validation, one adaptation, one style-consistency) confirmed every site before patches were applied. Commit messages and this PR body were drafted by Claude Code and reviewed before pushing.


@stdlib-js/reviewers


Generated by Claude Code

claude added 3 commits June 3, 2026 13:21
Propagates fix from 7563015 ("refactor: use `offsetX` parameter
name in `strided/nanrange`") to a sibling strided package where the
TypeScript declaration still used the unqualified `offset` parameter
name in the ndarray signature.
Propagates fix from 056a080 ("refactor: remove unused generics")
and e8a15dd ("refactor: remove unused generic in
`stats/base/ndarray/minsorted`") to sibling ndarray packages whose
TypeScript declarations introduced a generic parameter `T` that was
only ever used inside the input array tuple and never constrained
or returned, so the indirection added nothing.
Propagates fix from 9ee909b ("refactor: align parameter name with
implementation in `incr/nanstdev`") to sibling incremental accumulator
packages whose TypeScript declarations used `mu` for the optional
known-mean parameter while the JavaScript implementations consistently
used `mean`.
@stdlib-bot stdlib-bot added the Statistics Issue or pull request related to statistical functionality. label Jun 3, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

stdlib-bot commented Jun 3, 2026

Coverage Report

Package Statements Branches Functions Lines
stats/base/ndarray/dmeanstdev $\color{green}131/131$
$\color{green}+0.00\%$
$\color{green}3/3$
$\color{green}+0.00\%$
$\color{green}1/1$
$\color{green}+0.00\%$
$\color{green}131/131$
$\color{green}+0.00\%$
stats/base/ndarray/dnanstdev $\color{green}127/127$
$\color{green}+0.00\%$
$\color{green}3/3$
$\color{green}+0.00\%$
$\color{green}1/1$
$\color{green}+0.00\%$
$\color{green}127/127$
$\color{green}+0.00\%$
stats/base/ndarray/dnanstdevch $\color{green}127/127$
$\color{green}+0.00\%$
$\color{green}3/3$
$\color{green}+0.00\%$
$\color{green}1/1$
$\color{green}+0.00\%$
$\color{green}127/127$
$\color{green}+0.00\%$
stats/base/ndarray/dnanstdevpn $\color{green}127/127$
$\color{green}+0.00\%$
$\color{green}3/3$
$\color{green}+0.00\%$
$\color{green}1/1$
$\color{green}+0.00\%$
$\color{green}127/127$
$\color{green}+0.00\%$
stats/base/ndarray/sstdev $\color{green}118/118$
$\color{green}+0.00\%$
$\color{green}3/3$
$\color{green}+0.00\%$
$\color{green}1/1$
$\color{green}+0.00\%$
$\color{green}118/118$
$\color{green}+0.00\%$
stats/base/ndarray/sstdevch $\color{green}118/118$
$\color{green}+0.00\%$
$\color{green}3/3$
$\color{green}+0.00\%$
$\color{green}1/1$
$\color{green}+0.00\%$
$\color{green}118/118$
$\color{green}+0.00\%$
stats/base/ndarray/sstdevpn $\color{green}118/118$
$\color{green}+0.00\%$
$\color{green}3/3$
$\color{green}+0.00\%$
$\color{green}1/1$
$\color{green}+0.00\%$
$\color{green}118/118$
$\color{green}+0.00\%$
stats/base/ndarray/sstdevtk $\color{green}118/118$
$\color{green}+0.00\%$
$\color{green}3/3$
$\color{green}+0.00\%$
$\color{green}1/1$
$\color{green}+0.00\%$
$\color{green}118/118$
$\color{green}+0.00\%$
stats/base/ndarray/sstdevwd $\color{green}118/118$
$\color{green}+0.00\%$
$\color{green}3/3$
$\color{green}+0.00\%$
$\color{green}1/1$
$\color{green}+0.00\%$
$\color{green}118/118$
$\color{green}+0.00\%$
stats/base/ndarray/sstdevyc $\color{green}118/118$
$\color{green}+0.00\%$
$\color{green}3/3$
$\color{green}+0.00\%$
$\color{green}1/1$
$\color{green}+0.00\%$
$\color{green}118/118$
$\color{green}+0.00\%$
stats/incr/nanvariance $\color{green}138/138$
$\color{green}+0.00\%$
$\color{green}10/10$
$\color{green}+0.00\%$
$\color{green}2/2$
$\color{green}+0.00\%$
$\color{green}138/138$
$\color{green}+0.00\%$
stats/incr/stdev $\color{green}215/215$
$\color{green}+0.00\%$
$\color{green}25/25$
$\color{green}+0.00\%$
$\color{green}3/3$
$\color{green}+0.00\%$
$\color{green}215/215$
$\color{green}+0.00\%$
stats/incr/variance $\color{green}214/214$
$\color{green}+0.00\%$
$\color{green}25/25$
$\color{green}+0.00\%$
$\color{green}3/3$
$\color{green}+0.00\%$
$\color{green}214/214$
$\color{green}+0.00\%$
stats/strided/meanwd $\color{green}295/295$
$\color{green}+0.00\%$
$\color{green}21/21$
$\color{green}+0.00\%$
$\color{green}3/3$
$\color{green}+0.00\%$
$\color{green}295/295$
$\color{green}+0.00\%$

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

@kgryte kgryte marked this pull request as ready for review June 4, 2026 23:39
@kgryte kgryte requested a review from a team June 4, 2026 23:39
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jun 4, 2026
@kgryte kgryte removed the Needs Review A pull request which needs code review. label Jun 4, 2026
@kgryte
Copy link
Copy Markdown
Member

kgryte commented Jun 5, 2026

As the CI failure is not due to changes introduced in this PR, I'll go ahead and merge.

@kgryte kgryte merged commit 8e32423 into develop Jun 5, 2026
32 of 33 checks passed
@kgryte kgryte deleted the philipp/fix-propagation-2026-06-03 branch June 5, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants