|
| 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 | +} |
0 commit comments