Skip to content

Commit

Permalink
lib Types and Documentations Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
graphemecluster committed Aug 25, 2022
1 parent 8d7ad8c commit ba0601e
Show file tree
Hide file tree
Showing 37 changed files with 190 additions and 179 deletions.
66 changes: 28 additions & 38 deletions src/lib/es2015.core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ interface NumberConstructor {
/**
* The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1
* that is representable as a Number value, which is approximately:
* 2.2204460492503130808472633361816 x 10‍−‍16.
* 2.2204460492503130808472633361816E−‍16 (2^-52).
*/
readonly EPSILON: number;

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

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

Expand Down Expand Up @@ -379,11 +379,11 @@ interface RegExpConstructor {

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

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

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

/**
* Returns the String value result of normalizing the string into the normalization form
* named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
* @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default
* is "NFC"
* @param form The normalization form to be used. The default value is "NFC".
*/
normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string;

/**
* Returns the String value result of normalizing the string into the normalization form
* named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
* @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default
* is "NFC"
*/
normalize(form?: string): string;
normalize(form?: "NFC" | "NFD" | "NFKC" | "NFKD"): string;

/**
* Returns a String value that is made from count copies appended together. If count is 0,
* the empty string is returned.
* @param count number of copies to append
* @param count The number of copies to append
*/
repeat(count: number): string;

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

/**
* Returns an `<a>` HTML anchor element and sets the name attribute to the text value
* Returns an `<a>` HTML anchor element and sets the name attribute value
* @deprecated A legacy feature for browser compatibility
* @param name
* @param name The name attribute value
*/
anchor(name: string): string;

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

/**
* Returns a `<font>` HTML element and sets the size attribute value
* @deprecated A legacy feature for browser compatibility
* @param size The size attribute value
*/
fontsize(size: number): string;

/**
* Returns a `<font>` HTML element and sets the size attribute value
* @deprecated A legacy feature for browser compatibility
*/
fontsize(size: string): string;
fontsize(size: number | string): string;

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

Expand Down Expand Up @@ -521,8 +510,9 @@ interface String {

interface StringConstructor {
/**
* Return the String value whose elements are, in order, the elements in the List elements.
* If length is 0, the empty string is returned.
* Returns a string created by a sequence of code points.
* If no arguments are given, the empty string is returned.
* @param codePoints A sequence of code points.
*/
fromCodePoint(...codePoints: number[]): string;

Expand All @@ -535,5 +525,5 @@ interface StringConstructor {
* @param template A well-formed template string call site representation.
* @param substitutions A set of substitution values.
*/
raw(template: { raw: readonly string[] | ArrayLike<string>}, ...substitutions: any[]): string;
raw(template: { raw: readonly string[] | ArrayLike<string> }, ...substitutions: any[]): string;
}
12 changes: 6 additions & 6 deletions src/lib/es2015.symbol.wellknown.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,22 +219,22 @@ interface String {
match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null;

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion src/lib/es2020.symbol.wellknown.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface RegExp {
/**
* Matches a string with this regular expression, and returns an iterable of matches
* containing the results of that search.
* @param string A string to search within.
* @param str A string to search within.
*/
[Symbol.matchAll](str: string): IterableIterator<RegExpMatchArray>;
}
26 changes: 21 additions & 5 deletions src/lib/es2021.string.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
interface String {
/**
* Replace all instances of a substring in a string, using a regular expression or search string.
* @param searchValue A string to search for.
* @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.
* Replaces all occurrences of substrings that match a search string or a regular expression.
* A `TypeError` will be thrown if a RegExp without a `g` (global) flag is used.
* @param searchValue A string or RegExp search value.
* @param replaceValue The replacement text.
*/
replaceAll(searchValue: string | RegExp, replaceValue: string): string;

/**
* Replace all instances of a substring in a string, using a regular expression or search string.
* @param searchValue A string to search for.
* Replaces all occurrences of substrings that match a search string or a regular expression.
* A `TypeError` will be thrown if a RegExp without a `g` (global) flag is used.
* @param searchValue A string or RegExp search value.
* @param replacer A function that returns the replacement text.
*/
replaceAll(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string;

/**
* Replaces all occurrences of substrings that match the method provided by `searchValue`.
* @param searchValue An object that supports searching for and replacing matches within a string.
* @param replaceValue The replacement text.
*/
replaceAll(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string;

/**
* Replaces all occurrences of substrings that match the method provided by `searchValue`.
* @param searchValue An object that supports searching for and replacing matches within a string.
* @param replacer A function that returns the replacement text.
*/
replaceAll(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string;
}
49 changes: 27 additions & 22 deletions src/lib/es5.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ interface String {
charAt(pos: number): string;

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

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

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

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

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

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

/**
* Returns a section of a string.
* @param start The index to the beginning of the specified portion of stringObj.
* @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.
* If this value is not specified, the substring continues to the end of stringObj.
* @param start The index to the beginning of the specified portion of the string.
* @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.
* If this value is not specified, the substring continues to the end of the string.
*/
slice(start?: number, end?: number): string;

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

/**
* Returns the substring at the specified location within a String object.
* @param start The zero-based index number indicating the beginning of the substring.
* @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.
* Returns the substring beginning at the specified index within a String object.
* @param start The zero-based index indicating the beginning of the substring.
* @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.
* If end is omitted, the characters from start through the end of the original string are returned.
*/
substring(start: number, end?: number): string;
Expand All @@ -484,9 +489,9 @@ interface String {

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

/**
* Allows manipulation and formatting of text strings and determination and location of substrings within strings.
* Allows manipulation and formatting of text strings and determination of location of substrings within strings.
*/
declare var String: StringConstructor;

Expand Down Expand Up @@ -570,13 +575,13 @@ interface NumberConstructor {

/**
* A value that is less than the largest negative number that can be represented in JavaScript.
* JavaScript displays NEGATIVE_INFINITY values as -infinity.
* JavaScript displays NEGATIVE_INFINITY values as -Infinity.
*/
readonly NEGATIVE_INFINITY: number;

/**
* A value greater than the largest number that can be represented in JavaScript.
* JavaScript displays POSITIVE_INFINITY values as infinity.
* JavaScript displays POSITIVE_INFINITY values as Infinity.
*/
readonly POSITIVE_INFINITY: number;
}
Expand Down Expand Up @@ -971,7 +976,7 @@ interface RegExp {

// Non-standard extensions
/** @deprecated A legacy feature for browser compatibility */
compile(pattern: string, flags?: string): this;
compile(pattern: string, flags?: string): RegExp;
}

interface RegExpConstructor {
Expand Down
6 changes: 3 additions & 3 deletions src/lib/scripthost.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ declare var WScript: {

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

/**
* Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions,
* Returns a JavaScript array with all the elements in the VBArray. If there are multiple dimensions,
* each successive dimension is appended to the end of the array.
* Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6]
* Example: [[1, 2, 3], [4, 5, 6]] becomes [1, 2, 3, 4, 5, 6]
*/
toArray(): T[];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3176,7 +3176,7 @@
],
"documentation": [
{
"text": "Allows manipulation and formatting of text strings and determination and location of substrings within strings.",
"text": "Allows manipulation and formatting of text strings and determination of location of substrings within strings.",
"kind": "text"
}
]
Expand Down
Loading

0 comments on commit ba0601e

Please sign in to comment.