@tsonic/js 10.0.39 → 10.0.41

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/globals.d.ts CHANGED
@@ -1,96 +1,220 @@
1
- import type { int, long, double } from "@tsonic/core/types.js";
1
+ import type { int, long } from "@tsonic/core/types.js";
2
+ import type { Date as JSRuntimeDate } from "./index/internal/index.js";
2
3
 
3
4
  declare global {
5
+ class RangeError extends Error {
6
+ constructor(message?: string);
7
+ }
8
+
9
+ interface ArrayLike<T> {
10
+ readonly length: int;
11
+ readonly [n: number]: T;
12
+ }
13
+
4
14
  interface String {
5
15
  readonly length: int;
6
- trim(): string;
7
- toUpperCase(): string;
8
- toLowerCase(): string;
16
+ at(index: int): string;
17
+ charAt(index: int): string;
18
+ charCodeAt(index: int): int;
19
+ codePointAt(index: int): int;
20
+ concat(...strings: string[]): string;
21
+ endsWith(searchString: string): boolean;
22
+ includes(searchString: string): boolean;
9
23
  indexOf(searchString: string, position?: int): int;
10
- split(separator: string, limit?: int): string[];
11
- includes(searchString: string, position?: int): boolean;
12
- startsWith(searchString: string, position?: int): boolean;
13
- endsWith(searchString: string, endPosition?: int): boolean;
24
+ isWellFormed(): boolean;
25
+ lastIndexOf(searchString: string, position?: int): int;
26
+ localeCompare(compareString: string): int;
27
+ match(pattern: string): string[] | undefined;
28
+ matchAll(pattern: string): string[][];
29
+ normalize(form?: string): string;
30
+ padEnd(targetLength: int, padString?: string): string;
31
+ padStart(targetLength: int, padString?: string): string;
32
+ repeat(count: int): string;
33
+ replace(searchValue: string, replaceValue: string): string;
34
+ replaceAll(searchValue: string, replaceValue: string): string;
35
+ search(pattern: string): int;
14
36
  slice(start?: int, end?: int): string;
37
+ split(separator: string, limit?: int): string[];
38
+ startsWith(searchString: string): boolean;
39
+ substr(start: int, length?: int): string;
15
40
  substring(start: int, end?: int): string;
16
- replace(searchValue: string, replaceValue: string): string;
17
- charAt(index: int): string;
18
- charCodeAt(index: int): int;
41
+ toLocaleLowerCase(): string;
42
+ toLocaleUpperCase(): string;
43
+ toLowerCase(): string;
44
+ toString(): string;
45
+ trim(): string;
46
+ trimLeft(): string;
47
+ trimRight(): string;
48
+ trimStart(): string;
49
+ trimEnd(): string;
50
+ toUpperCase(): string;
51
+ toWellFormed(): string;
52
+ valueOf(): string;
19
53
  }
54
+
55
+ interface StringConstructor {
56
+ fromCharCode(...codes: int[]): string;
57
+ fromCodePoint(...codePoints: int[]): string;
58
+ }
59
+
60
+ interface Number {
61
+ toString(): string;
62
+ valueOf(): number;
63
+ }
64
+
65
+ interface NumberConstructor {
66
+ readonly EPSILON: number;
67
+ readonly MAX_SAFE_INTEGER: number;
68
+ readonly MAX_VALUE: number;
69
+ readonly MIN_SAFE_INTEGER: number;
70
+ readonly MIN_VALUE: number;
71
+ readonly NEGATIVE_INFINITY: number;
72
+ readonly POSITIVE_INFINITY: number;
73
+ readonly NaN: number;
74
+ isFinite(value: number): boolean;
75
+ isInteger(value: number): boolean;
76
+ isNaN(value: number): boolean;
77
+ isSafeInteger(value: number): boolean;
78
+ parseFloat(str: string): number;
79
+ parseInt(str: string, radix?: number): number;
80
+ }
81
+
20
82
  interface Array<T> {
21
83
  readonly length: int;
22
84
  at(index: int): T;
23
- concat(...items: T[]): T[];
85
+ concat(...items: unknown[]): T[];
86
+ copyWithin(target: int, start?: int, end?: int): T[];
87
+ entries(): Iterable<[int, T]>;
24
88
  every(callback: (value: T) => boolean): boolean;
89
+ every(callback: (value: T, index: int, array: T[]) => boolean): boolean;
90
+ fill(value: T, start?: int, end?: int): T[];
25
91
  filter(callback: (value: T) => boolean): T[];
26
92
  filter(callback: (value: T, index: int) => boolean): T[];
93
+ filter(callback: (value: T, index: int, array: T[]) => boolean): T[];
27
94
  find(callback: (value: T) => boolean): T | undefined;
28
95
  find(callback: (value: T, index: int) => boolean): T | undefined;
96
+ find(callback: (value: T, index: int, array: T[]) => boolean): T | undefined;
29
97
  findIndex(callback: (value: T) => boolean): int;
30
98
  findIndex(callback: (value: T, index: int) => boolean): int;
99
+ findIndex(callback: (value: T, index: int, array: T[]) => boolean): int;
31
100
  findLast(callback: (value: T) => boolean): T | undefined;
32
101
  findLast(callback: (value: T, index: int) => boolean): T | undefined;
102
+ findLast(callback: (value: T, index: int, array: T[]) => boolean): T | undefined;
33
103
  findLastIndex(callback: (value: T) => boolean): int;
34
104
  findLastIndex(callback: (value: T, index: int) => boolean): int;
105
+ findLastIndex(callback: (value: T, index: int, array: T[]) => boolean): int;
35
106
  flat(depth?: int): unknown[];
107
+ flatMap<TResult>(callback: (value: T, index: int, array: T[]) => unknown): TResult[];
36
108
  forEach(callback: (value: T) => void): void;
37
109
  forEach(callback: (value: T, index: int) => void): void;
110
+ forEach(callback: (value: T, index: int, array: T[]) => void): void;
38
111
  includes(searchElement: T): boolean;
39
- includes(searchElement: T, fromIndex?: int): boolean;
40
112
  indexOf(searchElement: T, fromIndex?: int): int;
41
113
  join(separator?: string): string;
114
+ keys(): Iterable<int>;
42
115
  lastIndexOf(searchElement: T, fromIndex?: int): int;
43
116
  map<TResult>(callback: (value: T) => TResult): TResult[];
44
117
  map<TResult>(callback: (value: T, index: int) => TResult): TResult[];
118
+ map<TResult>(callback: (value: T, index: int, array: T[]) => TResult): TResult[];
119
+ pop(): T;
120
+ push(...items: T[]): int;
45
121
  reduce(callback: (previousValue: T, currentValue: T) => T): T;
46
- reduce<TResult>(
47
- callback: (previousValue: TResult, currentValue: T) => TResult,
48
- initialValue: TResult
49
- ): TResult;
50
- reduceRight<TResult>(
51
- callback: (previousValue: TResult, currentValue: T) => TResult,
52
- initialValue: TResult
53
- ): TResult;
122
+ reduce<TResult>(callback: (previousValue: TResult, currentValue: T) => TResult, initialValue: TResult): TResult;
123
+ reduce<TResult>(callback: (previousValue: TResult, currentValue: T, index: int) => TResult, initialValue: TResult): TResult;
124
+ reduce<TResult>(callback: (
125
+ previousValue: TResult,
126
+ currentValue: T,
127
+ index: int,
128
+ array: T[]
129
+ ) => TResult, initialValue: TResult): TResult;
130
+ reduceRight<TResult>(callback: (previousValue: TResult, currentValue: T) => TResult, initialValue: TResult): TResult;
131
+ reduceRight<TResult>(callback: (previousValue: TResult, currentValue: T, index: int) => TResult, initialValue: TResult): TResult;
132
+ reduceRight<TResult>(callback: (
133
+ previousValue: TResult,
134
+ currentValue: T,
135
+ index: int,
136
+ array: T[]
137
+ ) => TResult, initialValue: TResult): TResult;
138
+ reverse(): T[];
139
+ shift(): T;
54
140
  slice(start?: int, end?: int): T[];
55
141
  some(callback: (value: T) => boolean): boolean;
142
+ some(callback: (value: T, index: int, array: T[]) => boolean): boolean;
143
+ sort(compareFunc?: (left: T, right: T) => double): T[];
144
+ splice(start: int, deleteCount?: int, ...items: T[]): T[];
145
+ toLocaleString(): string;
146
+ toReversed(): T[];
147
+ toSorted(compareFunc?: (left: T, right: T) => double): T[];
148
+ toSpliced(start: int, deleteCount?: int, ...items: T[]): T[];
149
+ toString(): string;
150
+ unshift(...items: T[]): int;
151
+ values(): Iterable<T>;
152
+ with(index: int, value: T): T[];
56
153
  }
154
+
57
155
  interface ReadonlyArray<T> {
58
156
  readonly length: int;
59
157
  at(index: int): T;
60
- concat(...items: T[]): T[];
158
+ concat(...items: unknown[]): T[];
159
+ entries(): Iterable<[int, T]>;
61
160
  every(callback: (value: T) => boolean): boolean;
161
+ every(callback: (value: T, index: int, array: readonly T[]) => boolean): boolean;
62
162
  filter(callback: (value: T) => boolean): T[];
63
163
  filter(callback: (value: T, index: int) => boolean): T[];
164
+ filter(callback: (value: T, index: int, array: readonly T[]) => boolean): T[];
64
165
  find(callback: (value: T) => boolean): T | undefined;
65
166
  find(callback: (value: T, index: int) => boolean): T | undefined;
167
+ find(callback: (value: T, index: int, array: readonly T[]) => boolean): T | undefined;
66
168
  findIndex(callback: (value: T) => boolean): int;
67
169
  findIndex(callback: (value: T, index: int) => boolean): int;
170
+ findIndex(callback: (value: T, index: int, array: readonly T[]) => boolean): int;
68
171
  findLast(callback: (value: T) => boolean): T | undefined;
69
172
  findLast(callback: (value: T, index: int) => boolean): T | undefined;
173
+ findLast(callback: (value: T, index: int, array: readonly T[]) => boolean): T | undefined;
70
174
  findLastIndex(callback: (value: T) => boolean): int;
71
175
  findLastIndex(callback: (value: T, index: int) => boolean): int;
176
+ findLastIndex(callback: (value: T, index: int, array: readonly T[]) => boolean): int;
72
177
  flat(depth?: int): unknown[];
178
+ flatMap<TResult>(callback: (value: T, index: int, array: readonly T[]) => unknown): TResult[];
73
179
  forEach(callback: (value: T) => void): void;
74
180
  forEach(callback: (value: T, index: int) => void): void;
181
+ forEach(callback: (value: T, index: int, array: readonly T[]) => void): void;
75
182
  includes(searchElement: T): boolean;
76
- includes(searchElement: T, fromIndex?: int): boolean;
77
183
  indexOf(searchElement: T, fromIndex?: int): int;
78
184
  join(separator?: string): string;
185
+ keys(): Iterable<int>;
79
186
  lastIndexOf(searchElement: T, fromIndex?: int): int;
80
187
  map<TResult>(callback: (value: T) => TResult): TResult[];
81
188
  map<TResult>(callback: (value: T, index: int) => TResult): TResult[];
189
+ map<TResult>(callback: (value: T, index: int, array: readonly T[]) => TResult): TResult[];
82
190
  reduce(callback: (previousValue: T, currentValue: T) => T): T;
83
- reduce<TResult>(
84
- callback: (previousValue: TResult, currentValue: T) => TResult,
85
- initialValue: TResult
86
- ): TResult;
87
- reduceRight<TResult>(
88
- callback: (previousValue: TResult, currentValue: T) => TResult,
89
- initialValue: TResult
90
- ): TResult;
191
+ reduce<TResult>(callback: (previousValue: TResult, currentValue: T) => TResult, initialValue: TResult): TResult;
192
+ reduce<TResult>(callback: (previousValue: TResult, currentValue: T, index: int) => TResult, initialValue: TResult): TResult;
193
+ reduce<TResult>(callback: (
194
+ previousValue: TResult,
195
+ currentValue: T,
196
+ index: int,
197
+ array: readonly T[]
198
+ ) => TResult, initialValue: TResult): TResult;
199
+ reduceRight<TResult>(callback: (previousValue: TResult, currentValue: T) => TResult, initialValue: TResult): TResult;
200
+ reduceRight<TResult>(callback: (previousValue: TResult, currentValue: T, index: int) => TResult, initialValue: TResult): TResult;
201
+ reduceRight<TResult>(callback: (
202
+ previousValue: TResult,
203
+ currentValue: T,
204
+ index: int,
205
+ array: readonly T[]
206
+ ) => TResult, initialValue: TResult): TResult;
91
207
  slice(start?: int, end?: int): T[];
92
208
  some(callback: (value: T) => boolean): boolean;
209
+ some(callback: (value: T, index: int, array: readonly T[]) => boolean): boolean;
210
+ toLocaleString(): string;
211
+ toReversed(): T[];
212
+ toSorted(compareFunc?: (left: T, right: T) => double): T[];
213
+ toString(): string;
214
+ values(): Iterable<T>;
215
+ with(index: int, value: T): T[];
93
216
  }
217
+
94
218
  interface Console {
95
219
  log(...data: unknown[]): void;
96
220
  error(...data: unknown[]): void;
@@ -98,86 +222,133 @@ declare global {
98
222
  info(...data: unknown[]): void;
99
223
  debug(...data: unknown[]): void;
100
224
  }
101
- const console: Console;
102
- interface Date {
103
- toISOString(): string;
104
- getTime(): long;
225
+
226
+ interface ArrayConstructor {
227
+ isArray(value: unknown): boolean;
228
+ from(source: string): string[];
229
+ from<TResult>(source: string, mapfn: (value: string, index: int) => TResult): TResult[];
230
+ from<T>(source: Iterable<T> | ArrayLike<T>): T[];
231
+ from<T, TResult>(source: Iterable<T> | ArrayLike<T>, mapfn: (value: T, index: int) => TResult): TResult[];
232
+ of<T>(...items: T[]): T[];
105
233
  }
234
+
235
+ interface Date extends JSRuntimeDate {
236
+ }
237
+
106
238
  interface DateConstructor {
107
- new (): Date;
108
- new (value: string | number | long): Date;
239
+ new(): Date;
240
+ new(value: string | number | long): Date;
109
241
  now(): long;
110
242
  parse(s: string): long;
111
243
  }
112
- const Date: DateConstructor;
244
+
113
245
  interface JSON {
114
246
  parse<T = unknown>(text: string): T;
115
- stringify(
116
- value: unknown,
117
- replacer?: unknown,
118
- space?: string | number | int
119
- ): string;
247
+ stringify(value: unknown, replacer?: unknown, space?: string | number | int): string;
120
248
  }
121
- const JSON: JSON;
249
+
122
250
  interface Math {
123
- round(x: double): double;
124
- max(...values: double[]): double;
125
- min(...values: double[]): double;
126
- random(): double;
251
+ round(x: number): number;
252
+ max(...values: double[]): number;
253
+ min(...values: double[]): number;
254
+ random(): number;
127
255
  }
128
- const Math: Math;
256
+
129
257
  interface RegExpMatchArray extends Array<string> {
130
258
  index?: int;
131
259
  input?: string;
132
260
  }
261
+
133
262
  interface RegExp {
134
263
  exec(string: string): RegExpMatchArray | null;
135
264
  test(string: string): boolean;
136
265
  }
266
+
137
267
  interface RegExpConstructor {
138
- new (pattern: string | RegExp, flags?: string): RegExp;
268
+ new(pattern: string | RegExp, flags?: string): RegExp;
139
269
  (pattern: string | RegExp, flags?: string): RegExp;
140
270
  }
141
- const RegExp: RegExpConstructor;
271
+
142
272
  interface Map<K, V> {
143
273
  readonly size: int;
144
274
  clear(): void;
145
275
  delete(key: K): boolean;
146
276
  get(key: K): V | undefined;
277
+ entries(): Iterable<[K, V]>;
278
+ forEach(callback: (value: V) => void): void;
279
+ forEach(callback: (value: V, key: K) => void): void;
280
+ forEach(callback: (value: V, key: K, map: Map<K, V>) => void): void;
147
281
  has(key: K): boolean;
282
+ keys(): Iterable<K>;
148
283
  set(key: K, value: V): this;
284
+ values(): Iterable<V>;
285
+ [Symbol.iterator](): IterableIterator<[K, V]>;
149
286
  }
287
+
150
288
  interface MapConstructor {
151
- new <K, V>(entries?: readonly (readonly [K, V])[] | null): Map<K, V>;
289
+ new<K, V>(entries?: readonly (readonly [K, V])[] | null): Map<K, V>;
152
290
  }
153
- const Map: MapConstructor;
291
+
154
292
  interface Set<T> {
155
293
  readonly size: int;
156
294
  add(value: T): this;
157
295
  clear(): void;
158
296
  delete(value: T): boolean;
297
+ entries(): Iterable<[T, T]>;
298
+ forEach(callback: (value: T) => void): void;
299
+ forEach(callback: (value: T, key: T) => void): void;
300
+ forEach(callback: (value: T, key: T, set: Set<T>) => void): void;
159
301
  has(value: T): boolean;
302
+ keys(): Iterable<T>;
303
+ values(): Iterable<T>;
304
+ [Symbol.iterator](): IterableIterator<T>;
160
305
  }
306
+
161
307
  interface SetConstructor {
162
- new <T = unknown>(values?: readonly T[] | null): Set<T>;
308
+ new<T = unknown>(values?: readonly T[] | null): Set<T>;
309
+ }
310
+
311
+ interface ObjectConstructor {
312
+ entries(obj: unknown): [string, unknown][];
313
+ keys(obj: unknown): string[];
314
+ values(obj: unknown): unknown[];
163
315
  }
316
+
317
+ const String: StringConstructor;
318
+
319
+ const Number: NumberConstructor;
320
+
321
+ const console: Console;
322
+
323
+ const Date: DateConstructor;
324
+
325
+ const JSON: JSON;
326
+
327
+ const Math: Math;
328
+
329
+ const RegExp: RegExpConstructor;
330
+
331
+ const Map: MapConstructor;
332
+
164
333
  const Set: SetConstructor;
165
- function parseInt(str: string, radix?: int): long | undefined;
166
- function parseFloat(str: string): double;
167
- function isFinite(value: double): boolean;
168
- function isNaN(value: double): boolean;
169
- function setTimeout(
170
- handler: (...args: unknown[]) => void,
171
- timeout?: int,
172
- ...args: unknown[]
173
- ): int;
174
- function clearTimeout(id: int): void;
175
- function setInterval(
176
- handler: (...args: unknown[]) => void,
177
- timeout?: int,
178
- ...args: unknown[]
179
- ): int;
180
- function clearInterval(id: int): void;
334
+
335
+ const Object: ObjectConstructor;
336
+
337
+ function parseInt(str: string, radix?: number): number;
338
+
339
+ function parseFloat(str: string): number;
340
+
341
+ function isFinite(value: number): boolean;
342
+
343
+ function isNaN(value: number): boolean;
344
+
345
+ function setTimeout(handler: (...args: unknown[]) => void, timeout?: number, ...args: unknown[]): number;
346
+
347
+ function clearTimeout(id: number): void;
348
+
349
+ function setInterval(handler: (...args: unknown[]) => void, timeout?: number, ...args: unknown[]): number;
350
+
351
+ function clearInterval(id: number): void;
181
352
  }
182
353
 
183
354
  export {};