Skip to content

Atomics BigInt64Array and BigUint64Array typings #39491

@jtmthf

Description

@jtmthf

Search Terms

  • atomics
  • atomics bigint

Suggestion

According to the es2020 spec https://www.ecma-international.org/ecma-262/#sec-atomics-object, Atomics operations should support the use of BigInt64Array and BigUint64Array with bigint as the expected operand type.

This could be implemented by createingsrc/lib/es2020.sharedmemory.d.ts that augments the Atomics interface with support for BigInt64Array and BigUint64Array with bigint as the operand.

Use Cases

Atomic operations on 64-bit integers.

Examples

const buffer = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT));

Atomics.store(buffer, 0, 1n);  // -> 1n
Atomics.add(buffer, 0, 2n);    // -> 1n
Atomics.load(buffer, 0);       // -> 3n

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Fix AvailableA PR has been opened for this issueHelp WantedYou can do this

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions