diff --git a/src/lib/es2017.sharedmemory.d.ts b/src/lib/es2017.sharedmemory.d.ts index f658c8155364f..573ba52f488c7 100644 --- a/src/lib/es2017.sharedmemory.d.ts +++ b/src/lib/es2017.sharedmemory.d.ts @@ -92,13 +92,17 @@ interface Atomics { * agent is put to sleep causing execution to suspend until the timeout expires (returning * `"timed-out"`) or until the agent is awoken (returning `"ok"`); otherwise, returns * `"not-equal"`. + * @param typedArray An Int32Array that views a SharedArrayBuffer. + * @param index The position in the typedArray on which to wait. + * @param value The expected value to test. + * @param timeout Time to wait in milliseconds. Defaults to +Infinity. */ - wait(typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out"; + wait(typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out"; /** * Wakes up sleeping agents that are waiting on the given index of the array, returning the * number of agents that were awoken. - * @param typedArray A shared Int32Array. + * @param typedArray An Int32Array that views a SharedArrayBuffer. * @param index The position in the typedArray to wake up on. * @param count The number of sleeping agents to notify. Defaults to +Infinity. */ diff --git a/src/lib/es2020.sharedmemory.d.ts b/src/lib/es2020.sharedmemory.d.ts index aaf4b37e8947a..e7be2645a7ddd 100644 --- a/src/lib/es2020.sharedmemory.d.ts +++ b/src/lib/es2020.sharedmemory.d.ts @@ -1,3 +1,4 @@ +/// /// interface Atomics { @@ -60,13 +61,17 @@ interface Atomics { * agent is put to sleep causing execution to suspend until the timeout expires (returning * `"timed-out"`) or until the agent is awoken (returning `"ok"`); otherwise, returns * `"not-equal"`. + * @param typedArray A BigInt64Array that views a SharedArrayBuffer. + * @param index The position in the typedArray on which to wait. + * @param value The expected value to test. + * @param timeout Time to wait in milliseconds. Defaults to +Infinity. */ - wait(typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out"; + wait(typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out"; /** * Wakes up sleeping agents that are waiting on the given index of the array, returning the * number of agents that were awoken. - * @param typedArray A shared BigInt64Array. + * @param typedArray A BigInt64Array that views a SharedArrayBuffer. * @param index The position in the typedArray to wake up on. * @param count The number of sleeping agents to notify. Defaults to +Infinity. */ diff --git a/src/lib/es2024.sharedmemory.d.ts b/src/lib/es2024.sharedmemory.d.ts index 672c714508b0d..284476a5d0454 100644 --- a/src/lib/es2024.sharedmemory.d.ts +++ b/src/lib/es2024.sharedmemory.d.ts @@ -1,25 +1,24 @@ +/// /// interface Atomics { /** * A non-blocking, asynchronous version of wait which is usable on the main thread. - * Waits asynchronously on a shared memory location and returns a Promise - * @param typedArray A shared Int32Array or BigInt64Array. + * @param typedArray An Int32Array that views a SharedArrayBuffer. * @param index The position in the typedArray to wait on. * @param value The expected value to test. - * @param [timeout] The expected value to test. + * @param timeout Time to wait in milliseconds. Defaults to +Infinity. */ - waitAsync(typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; + waitAsync(typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; /** * A non-blocking, asynchronous version of wait which is usable on the main thread. - * Waits asynchronously on a shared memory location and returns a Promise - * @param typedArray A shared Int32Array or BigInt64Array. + * @param typedArray A BigInt64Array that views a SharedArrayBuffer. * @param index The position in the typedArray to wait on. * @param value The expected value to test. - * @param [timeout] The expected value to test. + * @param timeout Time to wait in milliseconds. Defaults to +Infinity. */ - waitAsync(typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; + waitAsync(typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } interface SharedArrayBuffer { diff --git a/tests/baselines/reference/es2024SharedMemory.types b/tests/baselines/reference/es2024SharedMemory.types index 121218adef80b..ab4eb7de922f1 100644 --- a/tests/baselines/reference/es2024SharedMemory.types +++ b/tests/baselines/reference/es2024SharedMemory.types @@ -66,12 +66,12 @@ const waitValue = Atomics.wait(int32, 0, 0); > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >Atomics.wait(int32, 0, 0) : "ok" | "not-equal" | "timed-out" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->Atomics.wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out"; } -> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ +>Atomics.wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out"; } +> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ >Atomics : Atomics > : ^^^^^^^ ->wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out"; } -> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ +>wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out"; } +> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ >int32 : Int32Array > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >0 : 0 diff --git a/tests/baselines/reference/sharedMemory.types b/tests/baselines/reference/sharedMemory.types index 136d5172d751f..731546d86a1c3 100644 --- a/tests/baselines/reference/sharedMemory.types +++ b/tests/baselines/reference/sharedMemory.types @@ -62,12 +62,12 @@ const waitValue = Atomics.wait(int32, 0, 0); > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >Atomics.wait(int32, 0, 0) : "ok" | "not-equal" | "timed-out" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->Atomics.wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out"; } -> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ +>Atomics.wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out"; } +> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ >Atomics : Atomics > : ^^^^^^^ ->wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out"; } -> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ +>wait : { (typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out"; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out"; } +> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ >int32 : Int32Array > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >0 : 0 @@ -82,12 +82,12 @@ const { async, value } = Atomics.waitAsync(int32, 0, 0); > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >Atomics.waitAsync(int32, 0, 0) : { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; } > : ^^^^^^^^^ ^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^ ->Atomics.waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } -> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ +>Atomics.waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } +> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ >Atomics : Atomics > : ^^^^^^^ ->waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } -> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ +>waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } +> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ >int32 : Int32Array > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >0 : 0 @@ -106,12 +106,12 @@ const { async: async64, value: value64 } = Atomics.waitAsync(int64, 0, BigInt(0) > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >Atomics.waitAsync(int64, 0, BigInt(0)) : { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; } > : ^^^^^^^^^ ^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^ ->Atomics.waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } -> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ +>Atomics.waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } +> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ >Atomics : Atomics > : ^^^^^^^ ->waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } -> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ +>waitAsync : { (typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; (typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; }; } +> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^^ >int64 : BigInt64Array > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >0 : 0