1
1
declare type PropertyKey = string | number | symbol ;
2
2
3
3
interface Array < T > {
4
- /**
5
- * Returns the value of the first element in the array where predicate is true, and undefined
4
+ /**
5
+ * Returns the value of the first element in the array where predicate is true, and undefined
6
6
* otherwise.
7
- * @param predicate find calls predicate once for each element of the array, in ascending
8
- * order, until it finds one where predicate returns true. If such an element is found, find
7
+ * @param predicate find calls predicate once for each element of the array, in ascending
8
+ * order, until it finds one where predicate returns true. If such an element is found, find
9
9
* immediately returns that element value. Otherwise, find returns undefined.
10
- * @param thisArg If provided, it will be used as the this value for each invocation of
10
+ * @param thisArg If provided, it will be used as the this value for each invocation of
11
11
* predicate. If it is not provided, undefined is used instead.
12
12
*/
13
13
find ( predicate : ( value : T , index : number , obj : Array < T > ) => boolean , thisArg ?: any ) : T | undefined ;
14
14
15
- /**
16
- * Returns the index of the first element in the array where predicate is true, and undefined
15
+ /**
16
+ * Returns the index of the first element in the array where predicate is true, and undefined
17
17
* otherwise.
18
- * @param predicate find calls predicate once for each element of the array, in ascending
19
- * order, until it finds one where predicate returns true. If such an element is found, find
18
+ * @param predicate find calls predicate once for each element of the array, in ascending
19
+ * order, until it finds one where predicate returns true. If such an element is found, find
20
20
* immediately returns that element value. Otherwise, find returns undefined.
21
- * @param thisArg If provided, it will be used as the this value for each invocation of
21
+ * @param thisArg If provided, it will be used as the this value for each invocation of
22
22
* predicate. If it is not provided, undefined is used instead.
23
23
*/
24
24
findIndex ( predicate : ( value : T ) => boolean , thisArg ?: any ) : number | undefined ;
25
25
26
26
/**
27
27
* Returns the this object after filling the section identified by start and end with value
28
28
* @param value value to fill array section with
29
- * @param start index to start filling the array at. If start is negative, it is treated as
30
- * length+start where length is the length of the array.
31
- * @param end index to stop filling the array at. If end is negative, it is treated as
29
+ * @param start index to start filling the array at. If start is negative, it is treated as
30
+ * length+start where length is the length of the array.
31
+ * @param end index to stop filling the array at. If end is negative, it is treated as
32
32
* length+end.
33
33
*/
34
34
fill ( value : T , start ?: number , end ?: number ) : T [ ] ;
35
35
36
- /**
36
+ /**
37
37
* Returns the this object after copying a section of the array identified by start and end
38
38
* to the same array starting at position target
39
- * @param target If target is negative, it is treated as length+target where length is the
40
- * length of the array.
41
- * @param start If start is negative, it is treated as length+start. If end is negative, it
39
+ * @param target If target is negative, it is treated as length+target where length is the
40
+ * length of the array.
41
+ * @param start If start is negative, it is treated as length+start. If end is negative, it
42
42
* is treated as length+end.
43
- * @param end If not specified, length of the this object is used as its default value.
43
+ * @param end If not specified, length of the this object is used as its default value.
44
44
*/
45
45
copyWithin ( target : number , start : number , end ?: number ) : T [ ] ;
46
46
}
@@ -114,7 +114,7 @@ interface Math {
114
114
log1p ( x : number ) : number ;
115
115
116
116
/**
117
- * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of
117
+ * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of
118
118
* the natural logarithms).
119
119
* @param x A numeric expression.
120
120
*/
@@ -190,14 +190,14 @@ interface Math {
190
190
interface NumberConstructor {
191
191
/**
192
192
* The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1
193
- * that is representable as a Number value, which is approximately:
193
+ * that is representable as a Number value, which is approximately:
194
194
* 2.2204460492503130808472633361816 x 10−16.
195
195
*/
196
196
readonly EPSILON : number ;
197
197
198
198
/**
199
199
* Returns true if passed value is finite.
200
- * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a
200
+ * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a
201
201
* number. Only finite values of the type number, result in true.
202
202
* @param number A numeric value.
203
203
*/
@@ -210,7 +210,7 @@ interface NumberConstructor {
210
210
isInteger ( number : number ) : boolean ;
211
211
212
212
/**
213
- * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
213
+ * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
214
214
* number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter
215
215
* to a number. Only values of the type number, that are also NaN, result in true.
216
216
* @param number A numeric value.
@@ -223,30 +223,30 @@ interface NumberConstructor {
223
223
*/
224
224
isSafeInteger ( number : number ) : boolean ;
225
225
226
- /**
227
- * The value of the largest integer n such that n and n + 1 are both exactly representable as
228
- * a Number value.
226
+ /**
227
+ * The value of the largest integer n such that n and n + 1 are both exactly representable as
228
+ * a Number value.
229
229
* The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1.
230
230
*/
231
231
readonly MAX_SAFE_INTEGER : number ;
232
232
233
- /**
234
- * The value of the smallest integer n such that n and n − 1 are both exactly representable as
235
- * a Number value.
233
+ /**
234
+ * The value of the smallest integer n such that n and n − 1 are both exactly representable as
235
+ * a Number value.
236
236
* The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)).
237
237
*/
238
238
readonly MIN_SAFE_INTEGER : number ;
239
239
240
240
/**
241
- * Converts a string to a floating-point number.
242
- * @param string A string that contains a floating-point number.
241
+ * Converts a string to a floating-point number.
242
+ * @param string A string that contains a floating-point number.
243
243
*/
244
244
parseFloat ( string : string ) : number ;
245
245
246
246
/**
247
247
* Converts A string to an integer.
248
248
* @param s A string to convert into a number.
249
- * @param radix A value between 2 and 36 that specifies the base of the number in numString.
249
+ * @param radix A value between 2 and 36 that specifies the base of the number in numString.
250
250
* If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
251
251
* All other strings are considered decimal.
252
252
*/
@@ -255,12 +255,12 @@ interface NumberConstructor {
255
255
256
256
interface Object {
257
257
/**
258
- * Determines whether an object has a property with the specified name.
258
+ * Determines whether an object has a property with the specified name.
259
259
* @param v A property name.
260
260
*/
261
261
hasOwnProperty ( v : PropertyKey ) : boolean
262
262
263
- /**
263
+ /**
264
264
* Determines whether a specified property is enumerable.
265
265
* @param v A property name.
266
266
*/
@@ -269,15 +269,15 @@ interface Object {
269
269
270
270
interface ObjectConstructor {
271
271
/**
272
- * Copy the values of all of the enumerable own properties from one or more source objects to a
272
+ * Copy the values of all of the enumerable own properties from one or more source objects to a
273
273
* target object. Returns the target object.
274
274
* @param target The target object to copy to.
275
275
* @param source The source object from which to copy properties.
276
276
*/
277
277
assign < T , U > ( target : T , source : U ) : T & U ;
278
278
279
279
/**
280
- * Copy the values of all of the enumerable own properties from one or more source objects to a
280
+ * Copy the values of all of the enumerable own properties from one or more source objects to a
281
281
* target object. Returns the target object.
282
282
* @param target The target object to copy to.
283
283
* @param source1 The first source object from which to copy properties.
@@ -286,7 +286,7 @@ interface ObjectConstructor {
286
286
assign < T , U , V > ( target : T , source1 : U , source2 : V ) : T & U & V ;
287
287
288
288
/**
289
- * Copy the values of all of the enumerable own properties from one or more source objects to a
289
+ * Copy the values of all of the enumerable own properties from one or more source objects to a
290
290
* target object. Returns the target object.
291
291
* @param target The target object to copy to.
292
292
* @param source1 The first source object from which to copy properties.
@@ -296,7 +296,7 @@ interface ObjectConstructor {
296
296
assign < T , U , V , W > ( target : T , source1 : U , source2 : V , source3 : W ) : T & U & V & W ;
297
297
298
298
/**
299
- * Copy the values of all of the enumerable own properties from one or more source objects to a
299
+ * Copy the values of all of the enumerable own properties from one or more source objects to a
300
300
* target object. Returns the target object.
301
301
* @param target The target object to copy to.
302
302
* @param sources One or more source objects from which to copy properties
@@ -324,17 +324,17 @@ interface ObjectConstructor {
324
324
setPrototypeOf ( o : any , proto : any ) : any ;
325
325
326
326
/**
327
- * Gets the own property descriptor of the specified object.
328
- * An own property descriptor is one that is defined directly on the object and is not
329
- * inherited from the object's prototype.
327
+ * Gets the own property descriptor of the specified object.
328
+ * An own property descriptor is one that is defined directly on the object and is not
329
+ * inherited from the object's prototype.
330
330
* @param o Object that contains the property.
331
331
* @param p Name of the property.
332
332
*/
333
333
getOwnPropertyDescriptor ( o : any , propertyKey : PropertyKey ) : PropertyDescriptor ;
334
334
335
335
/**
336
- * Adds a property to an object, or modifies attributes of an existing property.
337
- * @param o Object on which to add or modify the property. This can be a native JavaScript
336
+ * Adds a property to an object, or modifies attributes of an existing property.
337
+ * @param o Object on which to add or modify the property. This can be a native JavaScript
338
338
* object (that is, a user-defined object or a built in object) or a DOM object.
339
339
* @param p The property name.
340
340
* @param attributes Descriptor for the property. It can be for a data property or an accessor
@@ -358,63 +358,68 @@ interface RegExp {
358
358
*/
359
359
readonly flags : string ;
360
360
361
- /**
362
- * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular
363
- * expression. Default is false. Read-only.
361
+ /**
362
+ * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular
363
+ * expression. Default is false. Read-only.
364
364
*/
365
365
readonly sticky : boolean ;
366
366
367
- /**
368
- * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular
369
- * expression. Default is false. Read-only.
367
+ /**
368
+ * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular
369
+ * expression. Default is false. Read-only.
370
370
*/
371
371
readonly unicode : boolean ;
372
372
}
373
373
374
+ interface RegExpConstructor {
375
+ new ( pattern : RegExp , flags ?: string ) : RegExp ;
376
+ ( pattern : RegExp , flags ?: string ) : RegExp ;
377
+ }
378
+
374
379
interface String {
375
380
/**
376
- * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
377
- * value of the UTF-16 encoded code point starting at the string element at position pos in
378
- * the String resulting from converting this object to a String.
379
- * If there is no element at that position, the result is undefined.
381
+ * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
382
+ * value of the UTF-16 encoded code point starting at the string element at position pos in
383
+ * the String resulting from converting this object to a String.
384
+ * If there is no element at that position, the result is undefined.
380
385
* If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
381
386
*/
382
387
codePointAt ( pos : number ) : number | undefined ;
383
388
384
389
/**
385
- * Returns true if searchString appears as a substring of the result of converting this
386
- * object to a String, at one or more positions that are
390
+ * Returns true if searchString appears as a substring of the result of converting this
391
+ * object to a String, at one or more positions that are
387
392
* greater than or equal to position; otherwise, returns false.
388
- * @param searchString search string
393
+ * @param searchString search string
389
394
* @param position If position is undefined, 0 is assumed, so as to search all of the String.
390
395
*/
391
396
includes ( searchString : string , position ?: number ) : boolean ;
392
397
393
398
/**
394
- * Returns true if the sequence of elements of searchString converted to a String is the
395
- * same as the corresponding elements of this object (converted to a String) starting at
399
+ * Returns true if the sequence of elements of searchString converted to a String is the
400
+ * same as the corresponding elements of this object (converted to a String) starting at
396
401
* endPosition – length(this). Otherwise returns false.
397
402
*/
398
403
endsWith ( searchString : string , endPosition ?: number ) : boolean ;
399
404
400
405
/**
401
- * Returns the String value result of normalizing the string into the normalization form
406
+ * Returns the String value result of normalizing the string into the normalization form
402
407
* named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
403
408
* @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default
404
409
* is "NFC"
405
410
*/
406
411
normalize ( form ?: string ) : string ;
407
412
408
413
/**
409
- * Returns a String value that is made from count copies appended together. If count is 0,
414
+ * Returns a String value that is made from count copies appended together. If count is 0,
410
415
* T is the empty String is returned.
411
416
* @param count number of copies to append
412
417
*/
413
418
repeat ( count : number ) : string ;
414
419
415
420
/**
416
- * Returns true if the sequence of elements of searchString converted to a String is the
417
- * same as the corresponding elements of this object (converted to a String) starting at
421
+ * Returns true if the sequence of elements of searchString converted to a String is the
422
+ * same as the corresponding elements of this object (converted to a String) starting at
418
423
* position. Otherwise returns false.
419
424
*/
420
425
startsWith ( searchString : string , position ?: number ) : boolean ;
@@ -474,7 +479,7 @@ interface StringConstructor {
474
479
475
480
/**
476
481
* String.raw is intended for use as a tag function of a Tagged Template String. When called
477
- * as such the first argument will be a well formed template call site object and the rest
482
+ * as such the first argument will be a well formed template call site object and the rest
478
483
* parameter will contain the substitution values.
479
484
* @param template A well-formed template string call site representation.
480
485
* @param substitutions A set of substitution values.
0 commit comments