fix(@stdlib/random/streams/triangular): correct undefined RandomStream in TypeScript doctest examples#13234
Draft
Planeshifter wants to merge 2 commits into
Draft
Conversation
…am` in TypeScript doctest examples The job `Lint Random Files` failed after its daily random file sample included this package's type declarations, with the doctest runner throwing `RandomStream is not defined` while executing the `@example` blocks. Root cause: the module's default export is the lowercase `randomStream` constant; `RandomStream` only exists as a TypeScript type name. Several `@example` blocks in the `declare class RandomStream` and `interface Constructor` sections called `new RandomStream(...)` or `RandomStream.factory(...)` / `RandomStream.objectMode(...)` without first aliasing or referencing the actual runtime export, unlike sibling packages (e.g. `random/streams/minstd`) and this file's own final `randomStream` doc block, which alias `RandomStream` to `randomStream` before `new` calls and call `.factory`/`.objectMode` on the lowercase export directly. This commit adds the missing `var RandomStream = randomStream;` alias before each `new RandomStream(...)` call and switches the static `.factory`/`.objectMode` calls to the lowercase `randomStream` export, matching the established sibling convention. Classified as `fix` rather than `docs` per this repo's commit taxonomy, since TypeScript declaration files are part of a package's public API. Ref: https://github.com/stdlib-js/stdlib/actions/runs/28556769910
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
…pectError` blocks `Lint Changed Files` failed on this PR with `@typescript-eslint/no-unused-vars` on `test.ts`, which the workflow also lints whenever the corresponding `index.d.ts` changes. The flagged `const s1 = new RandomStream(...)` bindings exist only to satisfy `$ExpectError` (the compiler error is expected at the `new` call itself), so the assignment is unnecessary — `new RandomStream(...)` is a valid standalone expression statement and triggers the identical compiler diagnostic on the same line. Dropping the unused bindings fixes the lint error without changing what is being type-tested. This pattern is pre-existing and widespread across sibling `random/streams/*` packages; only this file was touched, since it is the one flagged by CI.
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.
Description
This pull request:
@exampleblocks inrandom/streams/triangular/docs/types/index.d.tsthat reference the undefined runtime identifierRandomStream.Failing run: https://github.com/stdlib-js/stdlib/actions/runs/28556769910
Symptom:
Lint Random Filesfailed after its daily random file sample included this package's type declarations. The doctest runner throwsRandomStream is not definedwhile executing the@exampleblocks.Root cause: the module's default export is the lowercase
randomStreamconstant;RandomStreamexists only as a TypeScript type name (declare class RandomStream extends Readable). Several@exampleblocks in thedeclare class RandomStreamandinterface Constructorsections callednew RandomStream(...)orRandomStream.factory(...)/RandomStream.objectMode(...)without referencing the actual runtime export, unlike sibling packages (e.g.random/streams/minstd) and this file's own finalrandomStreamdoc block.Fix: add the missing
var RandomStream = randomStream;alias before eachnew RandomStream(...)call and switch the static.factory/.objectModecalls to the lowercaserandomStreamexport, matching the established sibling convention. Comment-only change; no type declarations were modified.Related Issues
This pull request has no related issues.
Questions
No.
Other
Validation: cross-checked against
random/streams/minstd/docs/types/index.d.tsline-by-line to confirm identical aliasing/lowercasing convention; confirmedfactory/objectModeare declared members ofinterface Constructorso calling them on the lowercaserandomStreamexport is valid; confirmed no otherRandomStream./new RandomStreamusages remain unaliased in the file; confirmed the diff touches only comment text, not type declarations. Three independent agent reviews (correctness, regression scope, style) all approved with no blocking findings.Reviewer notes: the
minstdreference file has the identical latent bug in its owndestroy()example (new RandomStream()without a preceding alias), which this PR's target file no longer has. Worth a separate follow-up inminstd; out of scope here sincelint_random_filesdid not flag it in this run.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This pull request was prepared by Claude Code as part of an automated CI-failure investigation routine. Root cause was identified from job logs and the package's TypeScript declarations, cross-checked against the established sibling convention, and validated by three independent agent reviews.
@stdlib-js/reviewers
Generated by Claude Code