From dde7e2f25323503482df20404bed11ecd53248f4 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Mon, 14 Jan 2019 10:11:36 -0800 Subject: [PATCH] build: switch to typescript's es2015 typings (#28134) Note that this allows Angular to depend on the entirety of the ES2015 API, not just our restricted subset. This change is needed because our copy of the subset was out-of-date, and prevents us using ES2015 target in dev mode. This is a subset of https://github.com/angular/angular/pull/27738 PR Close #28134 --- modules/es6-subset.d.ts | 65 ---------------------------------------- modules/types.d.ts | 2 +- packages/es6-subset.d.ts | 65 ---------------------------------------- packages/types.d.ts | 2 +- 4 files changed, 2 insertions(+), 132 deletions(-) delete mode 100644 modules/es6-subset.d.ts delete mode 100644 packages/es6-subset.d.ts diff --git a/modules/es6-subset.d.ts b/modules/es6-subset.d.ts deleted file mode 100644 index caef53e496..0000000000 --- a/modules/es6-subset.d.ts +++ /dev/null @@ -1,65 +0,0 @@ - -/** - * Subset of lib.es2015.core.d.ts typings. - * Angular should not require use of ES6 runtime but some API usages are already present. - * See https://github.com/angular/angular/issues/5242 - * TODO(alexeagle): remove methods below which may not be present in targeted browser - */ - -interface String { - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. - */ - startsWith(searchString: string, position?: number): boolean; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. - */ - endsWith(searchString: string, endPosition?: number): boolean; -} - -interface Array { - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @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(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): T[]; -} - -interface NumberConstructor { - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(number: number): boolean; -} - -// Workaround https://github.com/Microsoft/TypeScript/issues/9193 -interface PromiseConstructor { - all(values: (T|PromiseLike)[]): Promise; -} - -interface Function { - /** - * Returns the name of the function. Function names are read-only and can not be changed. - */ - readonly name: string; -} diff --git a/modules/types.d.ts b/modules/types.d.ts index 7d0eb482b2..1084916097 100644 --- a/modules/types.d.ts +++ b/modules/types.d.ts @@ -13,5 +13,5 @@ /// /// /// -/// +/// /// diff --git a/packages/es6-subset.d.ts b/packages/es6-subset.d.ts deleted file mode 100644 index 2f16198223..0000000000 --- a/packages/es6-subset.d.ts +++ /dev/null @@ -1,65 +0,0 @@ - -/** - * Subset of lib.es2015.core.d.ts typings. - * Angular should not require use of ES6 runtime but some API usages are already present. - * See https://github.com/angular/angular/issues/5242 - * TODO(alexeagle): remove methods below which may not be present in targeted browser - */ - -interface String { - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. - */ - startsWith(searchString: string, position?: number): boolean; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. - */ - endsWith(searchString: string, endPosition?: number): boolean; -} - -interface Array { - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @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(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T|undefined; - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): T[]; -} - -interface NumberConstructor { - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(number: number): boolean; -} - -// Workaround https://github.com/Microsoft/TypeScript/issues/9193 -interface PromiseConstructor { - all(values: (T|PromiseLike)[]): Promise; -} - -interface Function { - /** - * Returns the name of the function. Function names are read-only and can not be changed. - */ - readonly name: string; -} diff --git a/packages/types.d.ts b/packages/types.d.ts index 16e7e07562..87f212e64e 100644 --- a/packages/types.d.ts +++ b/packages/types.d.ts @@ -10,7 +10,7 @@ /// /// -/// +/// /// ///