Skip to content

Fix TypeScript Random.fill typed array handling#5115

Open
Shiven0504 wants to merge 1 commit into
clockworklabs:masterfrom
Shiven0504:codex/fix-ts-random-fill
Open

Fix TypeScript Random.fill typed array handling#5115
Shiven0504 wants to merge 1 commit into
clockworklabs:masterfrom
Shiven0504:codex/fix-ts-random-fill

Conversation

@Shiven0504
Copy link
Copy Markdown
Contributor

Summary

  • Make TypeScript Random.fill detect BigInt typed arrays by array type instead of array.at(0), so empty typed arrays are still handled correctly.
  • Use Math.pow for numeric typed-array bounds so 32-bit arrays use the full 32-bit range instead of JS bit-shift wrapping.
  • Add focused coverage for Random.fill availability, all integer typed arrays, and empty arrays.

Fixes #5091.

Tests

  • corepack pnpm --filter spacetimedb exec vitest run tests/rng.test.ts
  • corepack pnpm --filter spacetimedb build:types
  • corepack pnpm --filter spacetimedb exec prettier src/server/rng.ts tests/rng.test.ts --check --ignore-path ../../.prettierignore

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.

Random::fill not implemented in runtime (typescript)

1 participant