Skip to content

refactor: align and simplify array TypeScript declarations#12366

Draft
Planeshifter wants to merge 1 commit into
developfrom
philipp/refactor-array-ts-declarations
Draft

refactor: align and simplify array TypeScript declarations#12366
Planeshifter wants to merge 1 commit into
developfrom
philipp/refactor-array-ts-declarations

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

Description

This pull request applies behavior-neutral cleanups to several @stdlib/array TypeScript declarations, surfaced by an audit of the namespace's declaration files:

  • base/to-deduped: the declared function and its @example blocks used the internal name dedupe; renamed to the public toDeduped (and export = toDeduped).
  • base/without: the interface was named ArrayWith (copy-pasted from with); renamed to Without.
  • base/cunone: the interface used a lowercase cunone identifier; renamed to CuNone to match the CuAny/CuEvery siblings.
  • base/bifurcate-indices-by: dropped the dead IndicesResults<T> type parameter (always instantiated as number); updated the type test accordingly.
  • base/assert/contains: renamed the Unary function type's parameter from x to value to match its documented @param value.
  • filled: the first overload used DataTypeMap<any>[U], leaving the type parameter T unused; switched to DataTypeMap<T>[U] (behaviorally identical).
  • typed-complex: the object overload used Iterable<any>; switched to Iterable<unknown> to match the typed sibling, and corrected a @returns description.

None of these changes affect runtime behavior or downstream-observable types.

Related Issues

None.

Questions

No.

Other

This is one of a series of PRs addressing findings from a TypeScript-declaration audit of the @stdlib/array namespace.

Two audit findings in this category were intentionally deferred from this PR: base/take-map (its assign overloads appear disconnected from the exported function and its declaration examples fail the doctest linter) and base/where (its assign examples reference an undefined assign and fail the doctest linter). Both require deeper, documentation-focused fixes and are better handled separately.

Checklist

AI Assistance

  • Yes

  • No

  • Code generation (e.g., when writing an implementation or fixing a bug)

  • Test/benchmark generation

  • Documentation (including examples)

  • Research and understanding

Disclosure

The issues addressed here were identified by a multi-agent audit run with Claude Code, and the changes were drafted by Claude Code under my direction and review. Each change was verified locally against the repository's TypeScript declaration doctest and $ExpectType linters.


@stdlib-js/reviewers

Apply behavior-neutral cleanups to several `array` declarations
surfaced by an audit of the namespace's declaration files:

-   `base/to-deduped`: the declared function and its examples used the
    internal name `dedupe`; rename to the public `toDeduped`.
-   `base/without`: the interface was named `ArrayWith` (copied from
    `with`); rename it to `Without`.
-   `base/cunone`: the interface used a lowercase `cunone` name;
    rename to `CuNone` to match the `CuAny`/`CuEvery` siblings.
-   `base/bifurcate-indices-by`: drop the dead `IndicesResults` type
    parameter, which was always instantiated as `number`.
-   `base/assert/contains`: rename the `Unary` type's parameter from
    `x` to `value` to match its documented `@param`.
-   `filled`: the first overload used `DataTypeMap<any>[U]`, leaving
    the type parameter `T` unused; use `DataTypeMap<T>[U]`.
-   `typed-complex`: the object overload used `Iterable<any>`; use
    `Iterable<unknown>` to match the `typed` sibling, and correct a
    `@returns` description.

None of these changes affect runtime behavior.

Signed-off-by: Philipp Burckhardt <pburckhardt@outlook.com>

---
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
array/base/assert/contains $\color{green}227/227$
$\color{green}+100.00\%$
$\color{green}23/23$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}227/227$
$\color{green}+100.00\%$
array/base/bifurcate-indices-by $\color{green}121/121$
$\color{green}+100.00\%$
$\color{green}9/9$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}121/121$
$\color{green}+100.00\%$
array/base/cunone $\color{green}398/398$
$\color{green}+100.00\%$
$\color{green}32/32$
$\color{green}+100.00\%$
$\color{green}6/6$
$\color{green}+100.00\%$
$\color{green}398/398$
$\color{green}+100.00\%$
array/base/to-deduped $\color{green}232/232$
$\color{green}+100.00\%$
$\color{green}23/23$
$\color{green}+100.00\%$
$\color{green}3/3$
$\color{green}+100.00\%$
$\color{green}232/232$
$\color{green}+100.00\%$
array/base/without $\color{green}350/350$
$\color{green}+100.00\%$
$\color{green}33/33$
$\color{green}+100.00\%$
$\color{green}5/5$
$\color{green}+100.00\%$
$\color{green}350/350$
$\color{green}+100.00\%$
array/filled $\color{green}418/418$
$\color{green}+100.00\%$
$\color{green}68/68$
$\color{green}+100.00\%$
$\color{green}3/3$
$\color{green}+100.00\%$
$\color{green}418/418$
$\color{green}+100.00\%$
array/typed-complex $\color{green}275/275$
$\color{green}+100.00\%$
$\color{green}13/13$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}275/275$
$\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