@tsonic/js-globals 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +59 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -150,6 +150,11 @@ declare global {
|
|
|
150
150
|
* Calls a defined callback function on each element of an array, and then flattens the result by one level.
|
|
151
151
|
*/
|
|
152
152
|
flatMap<U>(callback: (value: T, index: int, array: T[]) => U | U[]): U[];
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Returns an iterator over the array elements.
|
|
156
|
+
*/
|
|
157
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
153
158
|
}
|
|
154
159
|
|
|
155
160
|
interface ReadonlyArray<T> {
|
|
@@ -170,6 +175,7 @@ declare global {
|
|
|
170
175
|
concat(...items: (T | readonly T[])[]): T[];
|
|
171
176
|
join(separator?: string): string;
|
|
172
177
|
at(index: int): T | undefined;
|
|
178
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
173
179
|
}
|
|
174
180
|
|
|
175
181
|
interface ArrayConstructor {
|
|
@@ -518,6 +524,59 @@ declare global {
|
|
|
518
524
|
|
|
519
525
|
const Error: ErrorConstructor;
|
|
520
526
|
|
|
527
|
+
/**
|
|
528
|
+
* Map - key-value collection
|
|
529
|
+
*/
|
|
530
|
+
interface Map<K, V> {
|
|
531
|
+
readonly size: int;
|
|
532
|
+
get(key: K): V | undefined;
|
|
533
|
+
set(key: K, value: V): this;
|
|
534
|
+
has(key: K): boolean;
|
|
535
|
+
delete(key: K): boolean;
|
|
536
|
+
clear(): void;
|
|
537
|
+
keys(): IterableIterator<K>;
|
|
538
|
+
values(): IterableIterator<V>;
|
|
539
|
+
entries(): IterableIterator<[K, V]>;
|
|
540
|
+
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void): void;
|
|
541
|
+
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
interface MapConstructor {
|
|
545
|
+
new <K, V>(entries?: readonly (readonly [K, V])[] | null): Map<K, V>;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
const Map: MapConstructor;
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Set - unique value collection
|
|
552
|
+
*/
|
|
553
|
+
interface Set<T> {
|
|
554
|
+
readonly size: int;
|
|
555
|
+
add(value: T): this;
|
|
556
|
+
has(value: T): boolean;
|
|
557
|
+
delete(value: T): boolean;
|
|
558
|
+
clear(): void;
|
|
559
|
+
keys(): IterableIterator<T>;
|
|
560
|
+
values(): IterableIterator<T>;
|
|
561
|
+
entries(): IterableIterator<[T, T]>;
|
|
562
|
+
forEach(callbackfn: (value: T, value2: T, set: Set<T>) => void): void;
|
|
563
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
interface SetConstructor {
|
|
567
|
+
new <T>(values?: readonly T[] | null): Set<T>;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
const Set: SetConstructor;
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Timer functions
|
|
574
|
+
*/
|
|
575
|
+
function setTimeout(callback: (...args: any[]) => void, ms?: number, ...args: any[]): number;
|
|
576
|
+
function clearTimeout(id: number | undefined): void;
|
|
577
|
+
function setInterval(callback: (...args: any[]) => void, ms?: number, ...args: any[]): number;
|
|
578
|
+
function clearInterval(id: number | undefined): void;
|
|
579
|
+
|
|
521
580
|
/**
|
|
522
581
|
* Utility types (built into TypeScript)
|
|
523
582
|
*/
|