-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
fix(es2018): add a target and an initial lib #20385
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ interface Array<T> { | |
* @param thisArg If provided, it will be used as the this value for each invocation of | ||
* predicate. If it is not provided, undefined is used instead. | ||
*/ | ||
find<S extends T>(predicate: (this: void, value: T, index: number, obj: T[]) => value is S, thisArg?: any): S | undefined; | ||
find(predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): T | undefined; | ||
|
||
/** | ||
|
@@ -69,10 +70,16 @@ interface ArrayConstructor { | |
/** | ||
* Creates an array from an array-like object. | ||
* @param arrayLike An array-like object to convert to an array. | ||
*/ | ||
from<T>(arrayLike: ArrayLike<T>): T[]; | ||
|
||
/** | ||
* Creates an array from an iterable object. | ||
* @param arrayLike An array-like 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 = T>(arrayLike: ArrayLike<T>, mapfn?: (v: T, k: number) => U, thisArg?: any): U[]; | ||
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
/** | ||
* Returns a new array from a set of elements. | ||
|
@@ -182,7 +189,7 @@ interface Math { | |
* If any argument is NaN, the result is NaN. | ||
* If all arguments are either +0 or −0, the result is +0. | ||
*/ | ||
hypot(...values: number[] ): number; | ||
hypot(...values: number[]): number; | ||
|
||
/** | ||
* Returns the integral part of the a numeric expression, x, removing any fractional digits. | ||
|
@@ -370,6 +377,7 @@ interface ReadonlyArray<T> { | |
* @param thisArg If provided, it will be used as the this value for each invocation of | ||
* predicate. If it is not provided, undefined is used instead. | ||
*/ | ||
find<S extends T>(predicate: (this: void, value: T, index: number, obj: ReadonlyArray<T>) => value is S, thisArg?: any): S | undefined; | ||
find(predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean, thisArg?: any): T | undefined; | ||
|
||
/** | ||
|
@@ -461,7 +469,7 @@ interface String { | |
|
||
/** | ||
* Returns a String value that is made from count copies appended together. If count is 0, | ||
* T is the empty String is returned. | ||
* the empty string is returned. | ||
* @param count number of copies to append | ||
*/ | ||
repeat(count: number): string; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(out of scope for this PR but) this pattern repeats often enough that maybe there should be a virtual interface in
lib.es2015.iterable.d.ts
for this 🤔Only useful in
lib.*.d.ts
if interface augmentations are allowed to addextends
, though. Alternatively, end the separation betweeniterable
and non-iterable
declarations; but that might be undesirable for the folks still supporting IE without polyfills (please stop 🙏😉).