Skip to content

Commit d477511

Browse files
committed
lib: add Math.sumPrecise type definition (ES2026 / esnext)
1 parent 7964e22 commit d477511

4 files changed

Lines changed: 15 additions & 0 deletions

File tree

src/compiler/commandLineParser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ const libEntries: [string, string][] = [
256256
["esnext.disposable", "lib.esnext.disposable.d.ts"],
257257
["esnext.error", "lib.esnext.error.d.ts"],
258258
["esnext.intl", "lib.esnext.intl.d.ts"],
259+
["esnext.math", "lib.esnext.math.d.ts"],
259260
["esnext.sharedmemory", "lib.esnext.sharedmemory.d.ts"],
260261
["esnext.temporal", "lib.esnext.temporal.d.ts"],
261262
["esnext.typedarrays", "lib.esnext.typedarrays.d.ts"],

src/lib/esnext.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
/// <reference lib="esnext.typedarrays" />
1010
/// <reference lib="esnext.temporal" />
1111
/// <reference lib="esnext.date" />
12+
/// <reference lib="esnext.math" />

src/lib/esnext.math.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
interface Math {
2+
/**
3+
* Returns the sum of the values in the iterable using a more precise
4+
* summation algorithm than naive floating-point addition.
5+
* Returns `-0` if the iterable is empty.
6+
* @param numbers An iterable (such as an Array) of numbers.
7+
* @throws {TypeError} If `numbers` is not iterable, or if any value
8+
* in the iterable is not of type `number`.
9+
* @throws {RangeError} If the iterable yields 2^53 or more values.
10+
*/
11+
sumPrecise(numbers: Iterable<number>): number;
12+
}

src/lib/libs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
"esnext.decorators",
9393
"esnext.disposable",
9494
"esnext.error",
95+
"esnext.math",
9596
"esnext.intl",
9697
"esnext.sharedmemory",
9798
"esnext.temporal",

0 commit comments

Comments
 (0)