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

fix(es2018): add a target and an initial lib #20385

Merged
merged 2 commits into from
Dec 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ const es2017LibrarySource = [
const es2017LibrarySourceMap = es2017LibrarySource.map(source =>
({ target: "lib." + source, sources: ["header.d.ts", source] }));

const es2018LibrarySource = [];
const es2018LibrarySourceMap = es2018LibrarySource.map(source =>
({ target: "lib." + source, sources: ["header.d.ts", source] }));

const esnextLibrarySource = [
"esnext.asynciterable.d.ts"
];
Expand All @@ -166,15 +170,17 @@ const librarySourceMap = [
{ target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] },
{ target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] },
{ target: "lib.es2017.d.ts", sources: ["header.d.ts", "es2017.d.ts"] },
{ target: "lib.es2018.d.ts", sources: ["header.d.ts", "es2018.d.ts"] },
{ target: "lib.esnext.d.ts", sources: ["header.d.ts", "esnext.d.ts"] },

// JavaScript + all host library
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) },
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") },
{ target: "lib.es2016.full.d.ts", sources: ["header.d.ts", "es2016.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
{ target: "lib.es2017.full.d.ts", sources: ["header.d.ts", "es2017.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
{ target: "lib.es2018.full.d.ts", sources: ["header.d.ts", "es2018.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
{ target: "lib.esnext.full.d.ts", sources: ["header.d.ts", "esnext.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap, esnextLibrarySourceMap);
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap, es2018LibrarySourceMap, esnextLibrarySourceMap);

const libraryTargets = librarySourceMap.map(f =>
path.join(builtLocalDirectory, f.target));
Expand Down
10 changes: 9 additions & 1 deletion Jakefile.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ var es2017LibrarySourceMap = es2017LibrarySource.map(function (source) {
return { target: "lib." + source, sources: ["header.d.ts", source] };
});

var es2018LibrarySource = [];

var es2018LibrarySourceMap = es2018LibrarySource.map(function (source) {
return { target: "lib." + source, sources: ["header.d.ts", source] };
});

var esnextLibrarySource = [
"esnext.asynciterable.d.ts"
];
Expand All @@ -227,15 +233,17 @@ var librarySourceMap = [
{ target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] },
{ target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] },
{ target: "lib.es2017.d.ts", sources: ["header.d.ts", "es2017.d.ts"] },
{ target: "lib.es2018.d.ts", sources: ["header.d.ts", "es2018.d.ts"] },
{ target: "lib.esnext.d.ts", sources: ["header.d.ts", "esnext.d.ts"] },

// JavaScript + all host library
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) },
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") },
{ target: "lib.es2016.full.d.ts", sources: ["header.d.ts", "es2016.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
{ target: "lib.es2017.full.d.ts", sources: ["header.d.ts", "es2017.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
{ target: "lib.es2018.full.d.ts", sources: ["header.d.ts", "es2018.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
{ target: "lib.esnext.full.d.ts", sources: ["header.d.ts", "esnext.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap, esnextLibrarySourceMap);
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap, es2018LibrarySourceMap, esnextLibrarySourceMap);

var libraryTargets = librarySourceMap.map(function (f) {
return path.join(builtLocalDirectory, f.target);
Expand Down
2 changes: 0 additions & 2 deletions lib/cancellationToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,3 @@ function createCancellationToken(args) {
}
}
module.exports = createCancellationToken;

//# sourceMappingURL=cancellationToken.js.map
972 changes: 972 additions & 0 deletions lib/cs/diagnosticMessages.generated.json

Large diffs are not rendered by default.

972 changes: 972 additions & 0 deletions lib/de/diagnosticMessages.generated.json

Large diffs are not rendered by default.

5,834 changes: 5,834 additions & 0 deletions lib/enu/diagnosticMessages.generated.json.lcg

Large diffs are not rendered by default.

972 changes: 972 additions & 0 deletions lib/es/diagnosticMessages.generated.json

Large diffs are not rendered by default.

972 changes: 972 additions & 0 deletions lib/fr/diagnosticMessages.generated.json

Large diffs are not rendered by default.

972 changes: 972 additions & 0 deletions lib/it/diagnosticMessages.generated.json

Large diffs are not rendered by default.

972 changes: 972 additions & 0 deletions lib/ja/diagnosticMessages.generated.json

Large diffs are not rendered by default.

972 changes: 972 additions & 0 deletions lib/ko/diagnosticMessages.generated.json

Large diffs are not rendered by default.

1,556 changes: 1,053 additions & 503 deletions lib/lib.d.ts

Large diffs are not rendered by default.

1,478 changes: 997 additions & 481 deletions lib/lib.dom.d.ts

Large diffs are not rendered by default.

42 changes: 25 additions & 17 deletions lib/lib.dom.iterable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,6 @@ interface DOMTokenList {
[Symbol.iterator](): IterableIterator<string>;
}

interface FormData {
/**
* Returns an array of key, value pairs for every entry in the list
*/
entries(): IterableIterator<[string, string | File]>;
/**
* Returns a list of keys in the list
*/
keys(): IterableIterator<string>;
/**
* Returns a list of values in the list
*/
values(): IterableIterator<string | File>;

[Symbol.iterator](): IterableIterator<string | File>;
}

interface Headers {
[Symbol.iterator](): IterableIterator<[string, string]>;
/**
Expand Down Expand Up @@ -107,6 +90,31 @@ interface NodeListOf<TNode extends Node> {
[Symbol.iterator](): IterableIterator<TNode>;
}

interface HTMLCollectionBase {
[Symbol.iterator](): IterableIterator<Element>;
}

interface HTMLCollectionOf<T extends Element> {
[Symbol.iterator](): IterableIterator<T>;
}

interface FormData {
/**
* Returns an array of key, value pairs for every entry in the list
*/
entries(): IterableIterator<[string, string | File]>;
/**
* Returns a list of keys in the list
*/
keys(): IterableIterator<string>;
/**
* Returns a list of values in the list
*/
values(): IterableIterator<string | File>;

[Symbol.iterator](): IterableIterator<string | File>;
}
Copy link

@Jessidhia Jessidhia Dec 5, 2017

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 🤔

interface IterableCollection<K, V = K, I = V> {
  entries(): IterableIterator<[K, V]>;
  keys(): IterableIterator<K>;
  values(): IterableIterator<V>;
  [Symbol.iterator](): IterableIterator<I>
}

Only useful in lib.*.d.ts if interface augmentations are allowed to add extends, though. Alternatively, end the separation between iterable and non-iterable declarations; but that might be undesirable for the folks still supporting IE without polyfills (please stop 🙏😉).


interface URLSearchParams {
/**
* Returns an array of key, value pairs for every entry in the search params
Expand Down
14 changes: 11 additions & 3 deletions lib/lib.es2015.core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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[];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from<T, U, This>(arrayLike: ArrayLike<T>, mapfn: (this: This, v: T, k: number) => U, thisArg?: This): U[]?


/**
* Returns a new array from a set of elements.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion lib/lib.es2015.iterable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,19 @@ interface Array<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>): 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 = T>(iterable: Iterable<T>, mapfn?: (v: T, k: number) => U, thisArg?: any): U[];
from<T, U>(iterable: Iterable<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
}

interface ReadonlyArray<T> {
Expand Down
17 changes: 15 additions & 2 deletions lib/lib.es2015.symbol.wellknown.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ interface Promise<T> {
}

interface PromiseConstructor {
readonly [Symbol.species]: Function;
readonly [Symbol.species]: PromiseConstructor;
}

interface RegExp {
Expand Down Expand Up @@ -222,7 +222,7 @@ interface RegExp {
}

interface RegExpConstructor {
[Symbol.species](): RegExpConstructor;
readonly [Symbol.species]: RegExpConstructor;
}

interface String {
Expand Down Expand Up @@ -303,3 +303,16 @@ interface Float32Array {
interface Float64Array {
readonly [Symbol.toStringTag]: "Float64Array";
}

interface ArrayConstructor {
readonly [Symbol.species]: ArrayConstructor;
}
interface MapConstructor {
readonly [Symbol.species]: MapConstructor;
}
interface SetConstructor {
readonly [Symbol.species]: SetConstructor;
}
interface ArrayBufferConstructor {
readonly [Symbol.species]: ArrayBufferConstructor;
}
Loading