Skip to content

Commit ba0601e

Browse files
lib Types and Documentations Fix
1 parent 8d7ad8c commit ba0601e

37 files changed

+190
-179
lines changed

src/lib/es2015.core.d.ts

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ interface NumberConstructor {
194194
/**
195195
* The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1
196196
* that is representable as a Number value, which is approximately:
197-
* 2.2204460492503130808472633361816 x 10‍−‍16.
197+
* 2.2204460492503130808472633361816E−‍16 (2^-52).
198198
*/
199199
readonly EPSILON: number;
200200

@@ -229,14 +229,14 @@ interface NumberConstructor {
229229
/**
230230
* The value of the largest integer n such that n and n + 1 are both exactly representable as
231231
* a Number value.
232-
* The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1.
232+
* The value of Number.MAX_SAFE_INTEGER is 9007199254740991 (2^53 − 1).
233233
*/
234234
readonly MAX_SAFE_INTEGER: number;
235235

236236
/**
237237
* The value of the smallest integer n such that n and n − 1 are both exactly representable as
238238
* a Number value.
239-
* The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)).
239+
* The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−2^53 + 1).
240240
*/
241241
readonly MIN_SAFE_INTEGER: number;
242242

@@ -379,11 +379,11 @@ interface RegExpConstructor {
379379

380380
interface String {
381381
/**
382-
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
383-
* value of the UTF-16 encoded code point starting at the string element at position pos in
384-
* the String resulting from converting this object to a String.
385-
* If there is no element at that position, the result is undefined.
386-
* If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
382+
* Returns a non-negative integer less than 1114112 (0x110000) that is the code point value
383+
* starting at the string element at the specified position.
384+
* @param pos The zero-based index of the desired code point. If there is no character at the
385+
* specified index, undefined is returned. If a UTF-16 surrogate pair does not begin at pos,
386+
* the result is the code unit at pos.
387387
*/
388388
codePointAt(pos: number): number | undefined;
389389

@@ -397,46 +397,38 @@ interface String {
397397
includes(searchString: string, position?: number): boolean;
398398

399399
/**
400-
* Returns true if the sequence of elements of searchString converted to a String is the
401-
* same as the corresponding elements of this object (converted to a String) starting at
402-
* endPosition – length(this). Otherwise returns false.
400+
* Determines whether the string ends with a substring, ending at the specified index.
401+
* @param searchString The string to search for.
402+
* @param endPosition The index at which to begin searching for. The default value is the
403+
* length of searchString.
403404
*/
404405
endsWith(searchString: string, endPosition?: number): boolean;
405406

406407
/**
407408
* Returns the String value result of normalizing the string into the normalization form
408409
* named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
409-
* @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default
410-
* is "NFC"
410+
* @param form The normalization form to be used. The default value is "NFC".
411411
*/
412-
normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string;
413-
414-
/**
415-
* Returns the String value result of normalizing the string into the normalization form
416-
* named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
417-
* @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default
418-
* is "NFC"
419-
*/
420-
normalize(form?: string): string;
412+
normalize(form?: "NFC" | "NFD" | "NFKC" | "NFKD"): string;
421413

422414
/**
423415
* Returns a String value that is made from count copies appended together. If count is 0,
424416
* the empty string is returned.
425-
* @param count number of copies to append
417+
* @param count The number of copies to append
426418
*/
427419
repeat(count: number): string;
428420

429421
/**
430-
* Returns true if the sequence of elements of searchString converted to a String is the
431-
* same as the corresponding elements of this object (converted to a String) starting at
432-
* position. Otherwise returns false.
422+
* Determines whether the string starts with a substring, beginning at the specified index.
423+
* @param searchString The string to search for.
424+
* @param position The index at which to begin searching for. The default value is 0.
433425
*/
434426
startsWith(searchString: string, position?: number): boolean;
435427

436428
/**
437-
* Returns an `<a>` HTML anchor element and sets the name attribute to the text value
429+
* Returns an `<a>` HTML anchor element and sets the name attribute value
438430
* @deprecated A legacy feature for browser compatibility
439-
* @param name
431+
* @param name The name attribute value
440432
*/
441433
anchor(name: string): string;
442434

@@ -467,20 +459,16 @@ interface String {
467459
/**
468460
* Returns a `<font>` HTML element and sets the color attribute value
469461
* @deprecated A legacy feature for browser compatibility
462+
* @param color The color attribute value
470463
*/
471464
fontcolor(color: string): string;
472465

473466
/**
474467
* Returns a `<font>` HTML element and sets the size attribute value
475468
* @deprecated A legacy feature for browser compatibility
469+
* @param size The size attribute value
476470
*/
477-
fontsize(size: number): string;
478-
479-
/**
480-
* Returns a `<font>` HTML element and sets the size attribute value
481-
* @deprecated A legacy feature for browser compatibility
482-
*/
483-
fontsize(size: string): string;
471+
fontsize(size: number | string): string;
484472

485473
/**
486474
* Returns an `<i>` HTML element
@@ -491,6 +479,7 @@ interface String {
491479
/**
492480
* Returns an `<a>` HTML element and sets the href attribute value
493481
* @deprecated A legacy feature for browser compatibility
482+
* @param url The href attribute value
494483
*/
495484
link(url: string): string;
496485

@@ -521,8 +510,9 @@ interface String {
521510

522511
interface StringConstructor {
523512
/**
524-
* Return the String value whose elements are, in order, the elements in the List elements.
525-
* If length is 0, the empty string is returned.
513+
* Returns a string created by a sequence of code points.
514+
* If no arguments are given, the empty string is returned.
515+
* @param codePoints A sequence of code points.
526516
*/
527517
fromCodePoint(...codePoints: number[]): string;
528518

@@ -535,5 +525,5 @@ interface StringConstructor {
535525
* @param template A well-formed template string call site representation.
536526
* @param substitutions A set of substitution values.
537527
*/
538-
raw(template: { raw: readonly string[] | ArrayLike<string>}, ...substitutions: any[]): string;
528+
raw(template: { raw: readonly string[] | ArrayLike<string> }, ...substitutions: any[]): string;
539529
}

src/lib/es2015.symbol.wellknown.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,22 +219,22 @@ interface String {
219219
match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null;
220220

221221
/**
222-
* Replaces first match with string or all matches with RegExp.
223-
* @param searchValue A string or RegExp search value.
224-
* @param replaceValue A string containing the text to replace for match.
222+
* Replaces one or more occurrences of substrings that match the method provided by `searchValue`.
223+
* @param searchValue An object that supports searching for and replacing matches within a string.
224+
* @param replaceValue The replacement text.
225225
*/
226226
replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string;
227227

228228
/**
229-
* Replaces text in a string, using an object that supports replacement within a string.
230-
* @param searchValue A object can search for and replace matches within a string.
229+
* Replaces one or more occurrences of substrings that match the method provided by `searchValue`.
230+
* @param searchValue An object that supports searching for and replacing matches within a string.
231231
* @param replacer A function that returns the replacement text.
232232
*/
233233
replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string;
234234

235235
/**
236236
* Finds the first substring match in a regular expression search.
237-
* @param searcher An object which supports searching within a string.
237+
* @param searcher An object that supports searching within a string.
238238
*/
239239
search(searcher: { [Symbol.search](string: string): number; }): number;
240240

src/lib/es2020.symbol.wellknown.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface RegExp {
1313
/**
1414
* Matches a string with this regular expression, and returns an iterable of matches
1515
* containing the results of that search.
16-
* @param string A string to search within.
16+
* @param str A string to search within.
1717
*/
1818
[Symbol.matchAll](str: string): IterableIterator<RegExpMatchArray>;
1919
}

src/lib/es2021.string.d.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
11
interface String {
22
/**
3-
* Replace all instances of a substring in a string, using a regular expression or search string.
4-
* @param searchValue A string to search for.
5-
* @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.
3+
* Replaces all occurrences of substrings that match a search string or a regular expression.
4+
* A `TypeError` will be thrown if a RegExp without a `g` (global) flag is used.
5+
* @param searchValue A string or RegExp search value.
6+
* @param replaceValue The replacement text.
67
*/
78
replaceAll(searchValue: string | RegExp, replaceValue: string): string;
89

910
/**
10-
* Replace all instances of a substring in a string, using a regular expression or search string.
11-
* @param searchValue A string to search for.
11+
* Replaces all occurrences of substrings that match a search string or a regular expression.
12+
* A `TypeError` will be thrown if a RegExp without a `g` (global) flag is used.
13+
* @param searchValue A string or RegExp search value.
1214
* @param replacer A function that returns the replacement text.
1315
*/
1416
replaceAll(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string;
17+
18+
/**
19+
* Replaces all occurrences of substrings that match the method provided by `searchValue`.
20+
* @param searchValue An object that supports searching for and replacing matches within a string.
21+
* @param replaceValue The replacement text.
22+
*/
23+
replaceAll(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string;
24+
25+
/**
26+
* Replaces all occurrences of substrings that match the method provided by `searchValue`.
27+
* @param searchValue An object that supports searching for and replacing matches within a string.
28+
* @param replacer A function that returns the replacement text.
29+
*/
30+
replaceAll(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string;
1531
}

src/lib/es5.d.ts

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ interface String {
384384
charAt(pos: number): string;
385385

386386
/**
387-
* Returns the Unicode value of the character at the specified location.
387+
* Returns a non-negative integer less than 65536 (0x10000) that is the code unit value of the character at the specified index.
388388
* @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.
389389
*/
390390
charCodeAt(index: number): number;
@@ -410,42 +410,47 @@ interface String {
410410
lastIndexOf(searchString: string, position?: number): number;
411411

412412
/**
413-
* Determines whether two strings are equivalent in the current locale.
414-
* @param that String to compare to target string
413+
* Determines whether the reference string comes before, after or is equivalent to the specified string in the current locale.
414+
* Returns a negative integer if it comes before, a positive number if it comes after, and 0 if they are equivalent.
415+
* @param that The string to compare to.
415416
*/
416417
localeCompare(that: string): number;
417418

418419
/**
419420
* Matches a string with a regular expression, and returns an array containing the results of that search.
420-
* @param regexp A variable name or string literal containing the regular expression pattern and flags.
421+
* @param regexp The regular expression for matching. If the provided value is not a RegExp, it is implicitly
422+
* converted to a RegExp by using `new RegExp(regexp)`.
421423
*/
422424
match(regexp: string | RegExp): RegExpMatchArray | null;
423425

424426
/**
425-
* Replaces text in a string, using a regular expression or search string.
426-
* @param searchValue A string to search for.
427-
* @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.
427+
* Replaces one or more occurrences of substrings that match a search string or a regular expression.
428+
* Only the first occurrence will be replaced unless a RegExp with a `g` (global) flag is used.
429+
* @param searchValue A string or RegExp search value.
430+
* @param replaceValue The replacement text.
428431
*/
429432
replace(searchValue: string | RegExp, replaceValue: string): string;
430433

431434
/**
432-
* Replaces text in a string, using a regular expression or search string.
433-
* @param searchValue A string to search for.
435+
* Replaces one or more occurrences of substrings that match a search string or a regular expression.
436+
* Only the first occurrence will be replaced unless a RegExp with a `g` (global) flag is used.
437+
* @param searchValue A string or RegExp search value.
434438
* @param replacer A function that returns the replacement text.
435439
*/
436440
replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string;
437441

438442
/**
439443
* Finds the first substring match in a regular expression search.
440-
* @param regexp The regular expression pattern and applicable flags.
444+
* @param regexp The regular expression for matching. If the provided value is not a RegExp, it is implicitly
445+
* converted to a RegExp by using `new RegExp(regexp)`.
441446
*/
442447
search(regexp: string | RegExp): number;
443448

444449
/**
445450
* Returns a section of a string.
446-
* @param start The index to the beginning of the specified portion of stringObj.
447-
* @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end.
448-
* If this value is not specified, the substring continues to the end of stringObj.
451+
* @param start The index to the beginning of the specified portion of the string.
452+
* @param end The index to the end of the specified portion of the string. The substring includes the characters up to, but not including, the character indicated by end.
453+
* If this value is not specified, the substring continues to the end of the string.
449454
*/
450455
slice(start?: number, end?: number): string;
451456

@@ -457,9 +462,9 @@ interface String {
457462
split(separator: string | RegExp, limit?: number): string[];
458463

459464
/**
460-
* Returns the substring at the specified location within a String object.
461-
* @param start The zero-based index number indicating the beginning of the substring.
462-
* @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end.
465+
* Returns the substring beginning at the specified index within a String object.
466+
* @param start The zero-based index indicating the beginning of the substring.
467+
* @param end The zero-based index indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end.
463468
* If end is omitted, the characters from start through the end of the original string are returned.
464469
*/
465470
substring(start: number, end?: number): string;
@@ -484,9 +489,9 @@ interface String {
484489

485490
// IE extensions
486491
/**
487-
* Gets a substring beginning at the specified location and having the specified length.
492+
* Gets a substring beginning at the specified index and having the specified length.
488493
* @deprecated A legacy feature for browser compatibility
489-
* @param from The starting position of the desired substring. The index of the first character in the string is zero.
494+
* @param from The starting index of the desired substring. The index of the first character in the string is zero.
490495
* @param length The number of characters to include in the returned substring.
491496
*/
492497
substr(from: number, length?: number): string;
@@ -505,7 +510,7 @@ interface StringConstructor {
505510
}
506511

507512
/**
508-
* Allows manipulation and formatting of text strings and determination and location of substrings within strings.
513+
* Allows manipulation and formatting of text strings and determination of location of substrings within strings.
509514
*/
510515
declare var String: StringConstructor;
511516

@@ -570,13 +575,13 @@ interface NumberConstructor {
570575

571576
/**
572577
* A value that is less than the largest negative number that can be represented in JavaScript.
573-
* JavaScript displays NEGATIVE_INFINITY values as -infinity.
578+
* JavaScript displays NEGATIVE_INFINITY values as -Infinity.
574579
*/
575580
readonly NEGATIVE_INFINITY: number;
576581

577582
/**
578583
* A value greater than the largest number that can be represented in JavaScript.
579-
* JavaScript displays POSITIVE_INFINITY values as infinity.
584+
* JavaScript displays POSITIVE_INFINITY values as Infinity.
580585
*/
581586
readonly POSITIVE_INFINITY: number;
582587
}
@@ -971,7 +976,7 @@ interface RegExp {
971976

972977
// Non-standard extensions
973978
/** @deprecated A legacy feature for browser compatibility */
974-
compile(pattern: string, flags?: string): this;
979+
compile(pattern: string, flags?: string): RegExp;
975980
}
976981

977982
interface RegExpConstructor {

src/lib/scripthost.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ declare var WScript: {
175175

176176
/**
177177
* Creates a COM object.
178-
* @param strProgiID
178+
* @param strProgID
179179
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
180180
*/
181181
CreateObject(strProgID: string, strPrefix?: string): any;
@@ -277,9 +277,9 @@ interface VBArray<T = any> {
277277
ubound(dimension?: number): number;
278278

279279
/**
280-
* Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions,
280+
* Returns a JavaScript array with all the elements in the VBArray. If there are multiple dimensions,
281281
* each successive dimension is appended to the end of the array.
282-
* Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6]
282+
* Example: [[1, 2, 3], [4, 5, 6]] becomes [1, 2, 3, 4, 5, 6]
283283
*/
284284
toArray(): T[];
285285
}

tests/baselines/reference/completionsCommentsClass.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3176,7 +3176,7 @@
31763176
],
31773177
"documentation": [
31783178
{
3179-
"text": "Allows manipulation and formatting of text strings and determination and location of substrings within strings.",
3179+
"text": "Allows manipulation and formatting of text strings and determination of location of substrings within strings.",
31803180
"kind": "text"
31813181
}
31823182
]

0 commit comments

Comments
 (0)