Skip to content

fix: narrow type guard in @stdlib/assert/is-primitive-array#12453

Merged
kgryte merged 2 commits into
developfrom
philipp/fix-assert-is-primitive-array-guard
Jun 3, 2026
Merged

fix: narrow type guard in @stdlib/assert/is-primitive-array#12453
kgryte merged 2 commits into
developfrom
philipp/fix-assert-is-primitive-array-guard

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • narrows the type predicate of the @stdlib/assert/is-primitive-array declaration from value is Array<any> to value is Array<null | undefined | string | boolean | number | symbol>, mirroring the element union used by the sibling is-primitive predicate. A positive result now narrows to an array of JavaScript primitives rather than discarding the element-type information.

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?

Identified via a TypeScript-declaration audit of the @stdlib/assert namespace.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

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

This PR was authored primarily by Claude Code (Anthropic's CLI), which audited the @stdlib/assert TypeScript declarations and proposed and applied the fix. I reviewed the changes.


@stdlib-js/reviewers

Narrow the type predicate from `value is Array<any>` to
`value is Array<null | undefined | string | boolean | number | symbol>`,
mirroring the element union used by the sibling `is-primitive` predicate
so that a positive result narrows to an array of JavaScript primitives
rather than discarding the element-type information.

---
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
---
@Planeshifter Planeshifter requested a review from a team June 2, 2026 16:42
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jun 2, 2026
@Planeshifter Planeshifter requested a review from kgryte June 2, 2026 16:47
@stdlib-bot
Copy link
Copy Markdown
Contributor

stdlib-bot commented Jun 2, 2026

Coverage Report

No coverage information available.

@kgryte kgryte removed the Needs Review A pull request which needs code review. label Jun 3, 2026
Comment thread lib/node_modules/@stdlib/assert/is-primitive-array/docs/types/index.d.ts Outdated
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
@kgryte kgryte merged commit 8eac018 into develop Jun 3, 2026
12 checks passed
@kgryte kgryte deleted the philipp/fix-assert-is-primitive-array-guard branch June 3, 2026 01:58
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.

3 participants