docs: fix examples to use supported dtypes#13392
Merged
kgryte merged 2 commits intoJul 9, 2026
Merged
Conversation
The job `random_examples` on workflow `random_examples` failed on develop with `TypeError: invalid argument. Second argument must be one of the following: ... Value: \`bool\`.` in examples/index.js. Root cause: the example iterated over the full, unfiltered dtype list from `dtypes()`, which includes `'bool'`, but `onesLike` only accepts `dtypes( 'numeric_and_generic' )` (see lib/main.js). This commit changes the example to request the same filtered dtype list `onesLike` itself validates against, so every dtype it iterates over is one `onesLike` actually supports. Ref: https://github.com/stdlib-js/stdlib/actions/runs/28985865125
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
Planeshifter
commented
Jul 9, 2026
Commit fdf871e fixed the crash in examples/index.js by requesting `dtypes( 'numeric_and_generic' )` instead of the unfiltered `dtypes()` list, but README.md embeds its own copy of the same example and was left with the stale, crashing call. This commit applies the identical change there so the documented example matches the one that actually runs in CI.
kgryte
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #{{N/A}}.
Description
This pull request:
lib/node_modules/@stdlib/array/ones-like/examples/index.js, which crashed on the nightlyrandom_examplesCI run by iterating over a dtype list that includes dtypesonesLikedoesn't support.Related Issues
None.
Questions
No.
Other
Failing run: https://github.com/stdlib-js/stdlib/actions/runs/28985865125
Symptom:
TypeError: invalid argument. Second argument must be one of the following: ... Value: \bool`.thrown fromonesLike`, crashing the example script.Root cause: The example requested the full, unfiltered dtype list via
dtypes(), which includes'bool'.onesLikeonly acceptsdtypes( 'numeric_and_generic' )(seelib/main.js), so calling it with'bool'throws.Fix: Change the example to request
dtypes( 'numeric_and_generic' ), the same filtered listonesLikevalidates against, so every dtype iterated over is supported.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
This PR was written primarily by Claude Code as part of an automated CI-failure triage and fix routine, based on live GitHub Actions job log analysis. The fix was reviewed by three independent automated review passes (correctness, regression scope, style/conventions) before being proposed here; all three approved with no blocking findings.
@stdlib-js/reviewers
Generated by Claude Code