Skip to content

Commit fe4d811

Browse files
committed
revert: build: switch to typescript's es2015 typings (angular#28134)
This reverts commit dde7e2f.
1 parent 4142db0 commit fe4d811

4 files changed

Lines changed: 132 additions & 2 deletions

File tree

modules/es6-subset.d.ts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
2+
/**
3+
* Subset of lib.es2015.core.d.ts typings.
4+
* Angular should not require use of ES6 runtime but some API usages are already present.
5+
* See https://github.com/angular/angular/issues/5242
6+
* TODO(alexeagle): remove methods below which may not be present in targeted browser
7+
*/
8+
9+
interface String {
10+
/**
11+
* Returns true if the sequence of elements of searchString converted to a String is the
12+
* same as the corresponding elements of this object (converted to a String) starting at
13+
* position. Otherwise returns false.
14+
*/
15+
startsWith(searchString: string, position?: number): boolean;
16+
17+
/**
18+
* Returns true if the sequence of elements of searchString converted to a String is the
19+
* same as the corresponding elements of this object (converted to a String) starting at
20+
* endPosition – length(this). Otherwise returns false.
21+
*/
22+
endsWith(searchString: string, endPosition?: number): boolean;
23+
}
24+
25+
interface Array<T> {
26+
/**
27+
* Returns the value of the first element in the array where predicate is true, and undefined
28+
* otherwise.
29+
* @param predicate find calls predicate once for each element of the array, in ascending
30+
* order, until it finds one where predicate returns true. If such an element is found, find
31+
* immediately returns that element value. Otherwise, find returns undefined.
32+
* @param thisArg If provided, it will be used as the this value for each invocation of
33+
* predicate. If it is not provided, undefined is used instead.
34+
*/
35+
find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T;
36+
/**
37+
* Returns the this object after filling the section identified by start and end with value
38+
* @param value value to fill array section with
39+
* @param start index to start filling the array at. If start is negative, it is treated as
40+
* length+start where length is the length of the array.
41+
* @param end index to stop filling the array at. If end is negative, it is treated as
42+
* length+end.
43+
*/
44+
fill(value: T, start?: number, end?: number): T[];
45+
}
46+
47+
interface NumberConstructor {
48+
/**
49+
* Returns true if the value passed is an integer, false otherwise.
50+
* @param number A numeric value.
51+
*/
52+
isInteger(number: number): boolean;
53+
}
54+
55+
// Workaround https://github.com/Microsoft/TypeScript/issues/9193
56+
interface PromiseConstructor {
57+
all<T>(values: (T|PromiseLike<T>)[]): Promise<T[]>;
58+
}
59+
60+
interface Function {
61+
/**
62+
* Returns the name of the function. Function names are read-only and can not be changed.
63+
*/
64+
readonly name: string;
65+
}

modules/types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
/// <reference types="jasminewd2" />
1414
/// <reference types="node" />
1515
/// <reference types="zone.js" />
16-
/// <reference lib="es2015" />
16+
/// <reference path="./es6-subset.d.ts" />
1717
/// <reference path="./system.d.ts" />

packages/es6-subset.d.ts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
2+
/**
3+
* Subset of lib.es2015.core.d.ts typings.
4+
* Angular should not require use of ES6 runtime but some API usages are already present.
5+
* See https://github.com/angular/angular/issues/5242
6+
* TODO(alexeagle): remove methods below which may not be present in targeted browser
7+
*/
8+
9+
interface String {
10+
/**
11+
* Returns true if the sequence of elements of searchString converted to a String is the
12+
* same as the corresponding elements of this object (converted to a String) starting at
13+
* position. Otherwise returns false.
14+
*/
15+
startsWith(searchString: string, position?: number): boolean;
16+
17+
/**
18+
* Returns true if the sequence of elements of searchString converted to a String is the
19+
* same as the corresponding elements of this object (converted to a String) starting at
20+
* endPosition – length(this). Otherwise returns false.
21+
*/
22+
endsWith(searchString: string, endPosition?: number): boolean;
23+
}
24+
25+
interface Array<T> {
26+
/**
27+
* Returns the value of the first element in the array where predicate is true, and undefined
28+
* otherwise.
29+
* @param predicate find calls predicate once for each element of the array, in ascending
30+
* order, until it finds one where predicate returns true. If such an element is found, find
31+
* immediately returns that element value. Otherwise, find returns undefined.
32+
* @param thisArg If provided, it will be used as the this value for each invocation of
33+
* predicate. If it is not provided, undefined is used instead.
34+
*/
35+
find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T|undefined;
36+
/**
37+
* Returns the this object after filling the section identified by start and end with value
38+
* @param value value to fill array section with
39+
* @param start index to start filling the array at. If start is negative, it is treated as
40+
* length+start where length is the length of the array.
41+
* @param end index to stop filling the array at. If end is negative, it is treated as
42+
* length+end.
43+
*/
44+
fill(value: T, start?: number, end?: number): T[];
45+
}
46+
47+
interface NumberConstructor {
48+
/**
49+
* Returns true if the value passed is an integer, false otherwise.
50+
* @param number A numeric value.
51+
*/
52+
isInteger(number: number): boolean;
53+
}
54+
55+
// Workaround https://github.com/Microsoft/TypeScript/issues/9193
56+
interface PromiseConstructor {
57+
all<T>(values: (T|PromiseLike<T>)[]): Promise<T[]>;
58+
}
59+
60+
interface Function {
61+
/**
62+
* Returns the name of the function. Function names are read-only and can not be changed.
63+
*/
64+
readonly name: string;
65+
}

packages/types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
/// <reference types="hammerjs" />
1212
/// <reference types="zone.js" />
13-
/// <reference lib="es2015" />
13+
/// <reference path="./es6-subset.d.ts" />
1414
/// <reference path="./goog.d.ts" />
1515
/// <reference path="./system.d.ts" />
1616

0 commit comments

Comments
 (0)