@tsonic/js-globals 0.3.1 → 0.3.3

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.
Files changed (2) hide show
  1. package/index.d.ts +53 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -524,6 +524,59 @@ declare global {
524
524
 
525
525
  const Error: ErrorConstructor;
526
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
+
527
580
  /**
528
581
  * Utility types (built into TypeScript)
529
582
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsonic/js-globals",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Global type definitions for Tsonic JS mode (noLib: true, JavaScript semantics)",
5
5
  "main": "index.d.ts",
6
6
  "types": "index.d.ts",