-
-
Notifications
You must be signed in to change notification settings - Fork 200
✨ Add bigint typed arrays to fc.anything() with withBigInt and withTypedArray #6426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
…pedArray Co-authored-by: dubzzz <[email protected]>
Co-authored-by: dubzzz <[email protected]>
|
👋 A preview of the new documentation is available at: http://69495ae3f2623a90f86eac8e--dubzzz-fast-check.netlify.app |
@fast-check/ava
@fast-check/expect-type
fast-check
@fast-check/jest
@fast-check/packaged
@fast-check/poisoning
@fast-check/vitest
@fast-check/worker
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances fc.anything() to generate BigInt-based typed arrays (BigInt64Array and BigUint64Array) when both withBigInt: true and withTypedArray: true options are enabled, addressing issue #6293.
- Conditionally includes bigint typed arrays in the typed array generation logic
- Updates documentation to reflect the new behavior
- Adds comprehensive test coverage to validate the feature works correctly
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/fast-check/src/arbitrary/_internals/builders/AnyArbitraryBuilder.ts | Modified typedArray() function to accept withBigInt parameter and conditionally include bigInt64Array and bigUint64Array arbitraries |
| packages/fast-check/src/arbitrary/_internals/helpers/QualifiedObjectConstraints.ts | Updated JSDoc comment for withTypedArray to document that bigint typed arrays are included when combined with withBigInt |
| packages/fast-check/test/unit/arbitrary/_internals/builders/AnyArbitraryBuilder.spec.ts | Added test case to verify bigint typed arrays are generated with both flags, validation logic to ensure they're not generated otherwise, and helper function isBigIntTypedArray() |
| * Also generate typed arrays in: (Uint|Int)(8|16|32)Array and Float(32|64)Array | ||
| * Remark: no typed arrays made of bigint | ||
| * Also includes BigInt64Array and BigUint64Array when withBigInt is enabled |
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation has two consecutive lines both starting with "Also", which makes it less clear. Consider rephrasing to something like: "Also generate typed arrays including (Uint|Int)(8|16|32)Array, Float(32|64)Array, and BigInt64Array/BigUint64Array when withBigInt is enabled" for better readability and clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the documentation to avoid consecutive "Also" statements for better clarity. Commit c6f7557
| ); | ||
| } | ||
|
|
||
| function isBigIntTypedArray(v: unknown): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot add biginttypedarray typeof checks in isTypedArray too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added BigInt64Array and BigUint64Array checks to the isTypedArray helper function. Commit c6f7557
…rrays in isTypedArray Co-authored-by: dubzzz <[email protected]>
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.