Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ namespace ts {
["es2022.error", "lib.es2022.error.d.ts"],
["es2022.intl", "lib.es2022.intl.d.ts"],
["es2022.object", "lib.es2022.object.d.ts"],
["es2022.sharedmemory", "lib.es2022.sharedmemory.d.ts"],
["es2022.string", "lib.es2022.string.d.ts"],
["esnext.array", "lib.es2022.array.d.ts"],
["esnext.symbol", "lib.es2019.symbol.d.ts"],
Expand Down
1 change: 1 addition & 0 deletions src/lib/es2022.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
/// <reference lib="es2022.error" />
/// <reference lib="es2022.intl" />
/// <reference lib="es2022.object" />
/// <reference lib="es2022.sharedmemory" />
/// <reference lib="es2022.string" />
7 changes: 7 additions & 0 deletions src/lib/es2022.sharedmemory.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
interface Atomics {
/**
* A non-blocking, asynchronous version of wait and usable on the main thread.
* Waits asynchronously on a shared memory location and returns a Promise
*/
waitAsync(typedArray: BigInt64Array | Int32Array, index: number, value: bigint, timeout?: number): { async: false, value: "ok" | "not-equal" | "timed-out" } | { async: true, value: Promise<"ok" | "not-equal" | "timed-out"> };
}
1 change: 1 addition & 0 deletions src/lib/libs.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"es2022.error",
"es2022.intl",
"es2022.object",
"es2022.sharedmemory",
"es2022.string",
"esnext.intl",
// Default libraries
Expand Down
9 changes: 9 additions & 0 deletions tests/cases/conformance/es2022/es2022SharedMemory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// @target: esnext
// @lib: es2022.sharedmemory
// @noemit: true
// @strict: true

const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024);
const int32 = new Int32Array(sab);
Atomics.wait(int32, 0, 0);
await Atomics.waitAsync(int32, 0, 0);