Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib Types and Documentations Fix #49855

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/harness/fourslashInterfaceImpl.ts
Expand Up @@ -1189,9 +1189,12 @@ export namespace Completion {
interfaceEntry("Promise"),
typeEntry("Awaited"),
interfaceEntry("ArrayLike"),
interfaceEntry("ArrayLikeOrIterableTypes"),
typeEntry("ArrayLikeOrIterable"),
typeEntry("Partial"),
typeEntry("Required"),
typeEntry("Readonly"),
typeEntry("Writable"),
typeEntry("Pick"),
typeEntry("Record"),
typeEntry("Exclude"),
Expand Down
2 changes: 1 addition & 1 deletion src/lib/es2015.collection.d.ts
Expand Up @@ -64,7 +64,7 @@ interface WeakMap<K extends object, V> {
}

interface WeakMapConstructor {
new <K extends object = object, V = any>(entries?: readonly [K, V][] | null): WeakMap<K, V>;
new <K extends object = object, V = any>(entries?: readonly (readonly [K, V])[] | null): WeakMap<K, V>;
readonly prototype: WeakMap<object, any>;
}
declare var WeakMap: WeakMapConstructor;
Expand Down
147 changes: 82 additions & 65 deletions src/lib/es2015.core.d.ts

Large diffs are not rendered by default.

187 changes: 33 additions & 154 deletions src/lib/es2015.iterable.d.ts
Expand Up @@ -35,6 +35,10 @@ interface IterableIterator<T> extends Iterator<T> {
[Symbol.iterator](): IterableIterator<T>;
}

interface ArrayLikeOrIterableTypes<T> {
iterable: Iterable<T>;
}

interface Array<T> {
/** Iterator */
[Symbol.iterator](): IterableIterator<T>;
Expand All @@ -55,22 +59,6 @@ interface Array<T> {
values(): IterableIterator<T>;
}

interface ArrayConstructor {
/**
* Creates an array from an iterable object.
* @param iterable An iterable object to convert to an array.
*/
from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];

/**
* Creates an array from an iterable object.
* @param iterable An iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
}

interface ReadonlyArray<T> {
/** Iterator of values in the array. */
[Symbol.iterator](): IterableIterator<T>;
Expand Down Expand Up @@ -151,7 +139,7 @@ interface Set<T> {
/** Iterates over values in the set. */
[Symbol.iterator](): IterableIterator<T>;
/**
* Returns an iterable of [v,v] pairs for every value `v` in the set.
* Returns an iterable of [v, v] pairs for every value `v` in the set.
*/
entries(): IterableIterator<[T, T]>;
/**
Expand All @@ -170,7 +158,7 @@ interface ReadonlySet<T> {
[Symbol.iterator](): IterableIterator<T>;

/**
* Returns an iterable of [v,v] pairs for every value `v` in the set.
* Returns an iterable of [v, v] pairs for every value `v` in the set.
*/
entries(): IterableIterator<[T, T]>;

Expand Down Expand Up @@ -223,256 +211,147 @@ interface String {
interface Int8Array {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
* Yields index, value pairs for every entry in the array.
*/
entries(): IterableIterator<[number, number]>;
/**
* Returns an list of keys in the array
* Yields each index in the array.
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
* Yields each value in the array.
*/
values(): IterableIterator<number>;
}

interface Int8ArrayConstructor {
new (elements: Iterable<number>): Int8Array;

/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array;
}

interface Uint8Array {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
* Yields index, value pairs for every entry in the array.
*/
entries(): IterableIterator<[number, number]>;
/**
* Returns an list of keys in the array
* Yields each index in the array.
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
* Yields each value in the array.
*/
values(): IterableIterator<number>;
}

interface Uint8ArrayConstructor {
new (elements: Iterable<number>): Uint8Array;

/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array;
}

interface Uint8ClampedArray {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
* Yields index, value pairs for every entry in the array.
*/
entries(): IterableIterator<[number, number]>;

/**
* Returns an list of keys in the array
* Yields each index in the array.
*/
keys(): IterableIterator<number>;

/**
* Returns an list of values in the array
* Yields each value in the array.
*/
values(): IterableIterator<number>;
}

interface Uint8ClampedArrayConstructor {
new (elements: Iterable<number>): Uint8ClampedArray;


/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray;
}

interface Int16Array {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
* Yields index, value pairs for every entry in the array.
*/
entries(): IterableIterator<[number, number]>;

/**
* Returns an list of keys in the array
* Yields each index in the array.
*/
keys(): IterableIterator<number>;

/**
* Returns an list of values in the array
* Yields each value in the array.
*/
values(): IterableIterator<number>;
}

interface Int16ArrayConstructor {
new (elements: Iterable<number>): Int16Array;

/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array;
}

interface Uint16Array {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
* Yields index, value pairs for every entry in the array.
*/
entries(): IterableIterator<[number, number]>;
/**
* Returns an list of keys in the array
* Yields each index in the array.
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
* Yields each value in the array.
*/
values(): IterableIterator<number>;
}

interface Uint16ArrayConstructor {
new (elements: Iterable<number>): Uint16Array;

/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array;
}

interface Int32Array {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
* Yields index, value pairs for every entry in the array.
*/
entries(): IterableIterator<[number, number]>;
/**
* Returns an list of keys in the array
* Yields each index in the array.
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
* Yields each value in the array.
*/
values(): IterableIterator<number>;
}

interface Int32ArrayConstructor {
new (elements: Iterable<number>): Int32Array;

/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array;
}

interface Uint32Array {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
* Yields index, value pairs for every entry in the array.
*/
entries(): IterableIterator<[number, number]>;
/**
* Returns an list of keys in the array
* Yields each index in the array.
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
* Yields each value in the array.
*/
values(): IterableIterator<number>;
}

interface Uint32ArrayConstructor {
new (elements: Iterable<number>): Uint32Array;

/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array;
}

interface Float32Array {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
* Yields index, value pairs for every entry in the array.
*/
entries(): IterableIterator<[number, number]>;
/**
* Returns an list of keys in the array
* Yields each index in the array.
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
* Yields each value in the array.
*/
values(): IterableIterator<number>;
}

interface Float32ArrayConstructor {
new (elements: Iterable<number>): Float32Array;

/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array;
}

interface Float64Array {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
* Yields index, value pairs for every entry in the array.
*/
entries(): IterableIterator<[number, number]>;
/**
* Returns an list of keys in the array
* Yields each index in the array.
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
* Yields each value in the array.
*/
values(): IterableIterator<number>;
}

interface Float64ArrayConstructor {
new (elements: Iterable<number>): Float64Array;

/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;
}
16 changes: 9 additions & 7 deletions src/lib/es2015.symbol.wellknown.d.ts
Expand Up @@ -219,22 +219,24 @@ interface String {
match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null;

/**
* Passes a string and {@linkcode replaceValue} to the `[Symbol.replace]` method on {@linkcode searchValue}. This method is expected to implement its own replacement algorithm.
* Passes a string and {@linkcode replaceValue} to the `[Symbol.replace]` method on {@linkcode searchValue}.
* @param searchValue An object that supports searching for and replacing matches within a string.
* This object is expected to implement its own replacement algorithm.
* @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.
* @param replacer A function that returns the replacement text.
*/
/**
* Passes a string and {@linkcode replaceValue} to the `[Symbol.replace]` method on {@linkcode searchValue}.
* @param searchValue An object that supports searching for and replacing matches within a string.
* This object is expected to implement its own replacement algorithm.
* @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/es2017.object.d.ts
Expand Up @@ -27,5 +27,5 @@ interface ObjectConstructor {
* Returns an object containing all own property descriptors of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
getOwnPropertyDescriptors<T>(o: T): {[P in keyof T]: TypedPropertyDescriptor<T[P]>} & { [x: string]: PropertyDescriptor };
getOwnPropertyDescriptors<T extends {}>(o: T): { [P in keyof T]: TypedPropertyDescriptor<T[P]> } & PropertyDescriptorMap;
}