diff --git a/types/es6-shim/es6-shim-tests.ts b/types/es6-shim/es6-shim-tests.ts index 7d7fdc6db2..9d564742dc 100644 --- a/types/es6-shim/es6-shim-tests.ts +++ b/types/es6-shim/es6-shim-tests.ts @@ -1,23 +1,18 @@ -declare const require: (module: string) => Object; -if (require !== null) { - require('es6-shim'); -} - interface Point { x: number; y: number; } interface Point3D extends Point { z: number; } let a: any; -let s: string = ''; -let i: number = 2; +let s = ''; +let i = 2; let iOrUndef: number | undefined; let b: boolean; let f: () => void = () => {}; let o: Object; let r: RegExp = /a/; -let sym: symbol = {} as symbol; +declare const sym: symbol; let e: Error = new Error(); let date: Date; -let key: KeyOfProperty; +let key: PropertyKey; let point: Point = { x: 1, y: 2 }; let point3d: Point3D = { x: 1, y: 2, z: 3 }; let point3dOrUndef: Point3D | undefined; @@ -25,9 +20,9 @@ let pointOrUndef: Point | undefined; let arrayOfPoint: Point[] = []; let arrayOfPoint3D: Point3D[]; let arrayOfSymbol: symbol[]; -let arrayOfPropertyKey: KeyOfProperty[]; +let arrayOfPropertyKey: PropertyKey[]; let arrayOfAny: any[]; -let arrayOfStringAny: [string, any][]; +let arrayOfStringAny: Array<[string, any]>; let arrayLikeOfAny: ArrayLike = []; let iterableOfPoint: IterableShim = []; let iterableOfStringPoint: IterableShim<[string, Point]> = []; @@ -40,8 +35,8 @@ let iterableIteratorOfPointPoint: IterableIteratorShim<[Point, Point]>; let iterableIteratorOfNode: IterableIteratorShim; let iterableIteratorOfStringPoint: IterableIteratorShim<[string, Point]>; let iterableIteratorOfAny: IterableIteratorShim; -let iterableIteratorOfPropertyKey: IterableIteratorShim; -let iterableIteratorOfPropertyKeyPoint: IterableIteratorShim<[KeyOfProperty, Point]>; +let iterableIteratorOfPropertyKey: IterableIteratorShim; +let iterableIteratorOfPropertyKeyPoint: IterableIteratorShim<[PropertyKey, Point]>; let nodeList: NodeList; let pd: PropertyDescriptor = {}; let pdm: PropertyDescriptorMap = {}; @@ -86,7 +81,7 @@ b = Number.isSafeInteger(i); i = Number.MAX_SAFE_INTEGER; i = Number.MIN_SAFE_INTEGER; i = Number.parseFloat(s); -i = Number.parseInt(s); +i = Number.parseInt(s, 10); i = Number.parseInt(s, i); i = Math.clz32(i); i = Math.imul(i, i); diff --git a/types/es6-shim/index.d.ts b/types/es6-shim/index.d.ts index e2c1a01f3d..6f03bdd7ef 100644 --- a/types/es6-shim/index.d.ts +++ b/types/es6-shim/index.d.ts @@ -2,10 +2,6 @@ // Project: https://github.com/paulmillr/es6-shim // Definitions by: Ron Buckton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -// TODO: As of TypeScript@2.9 there is a global type PropertyKey that should be used instead of this. -declare type KeyOfProperty = string | number | symbol; interface IteratorResult { done: boolean; @@ -105,10 +101,10 @@ interface String { bold(): string; /** Returns a HTML element */ - fixed(): string + fixed(): string; /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string + fontcolor(color: string): string; /** Returns a HTML element and sets the size attribute value */ fontsize(size: number): string; @@ -147,7 +143,7 @@ interface ArrayConstructor { * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; /** * Creates an array from an iterable object. @@ -155,25 +151,25 @@ interface ArrayConstructor { * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(iterable: IterableShim, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + from(iterable: IterableShim, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; /** * Creates an array from an array-like object. * @param arrayLike An array-like object to convert to an array. */ - from(arrayLike: ArrayLike): Array; + from(arrayLike: ArrayLike): T[]; /** * Creates an array from an iterable object. * @param iterable An iterable object to convert to an array. */ - from(iterable: IterableShim): Array; + from(iterable: IterableShim): T[]; /** * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ - of(...items: T[]): Array; + of(...items: T[]): T[]; } interface Array { @@ -186,7 +182,7 @@ interface Array { * @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; + find(predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): T | undefined; /** * Returns the index of the first element in the array where predicate is true, and -1 otherwise. @@ -626,17 +622,17 @@ declare var WeakSet: WeakSetConstructor; declare namespace Reflect { function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; function construct(target: Function, argumentsList: ArrayLike): any; - function defineProperty(target: any, propertyKey: KeyOfProperty, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: KeyOfProperty): boolean; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; function enumerate(target: any): IterableIteratorShim; - function get(target: any, propertyKey: KeyOfProperty, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: KeyOfProperty): PropertyDescriptor; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: KeyOfProperty): boolean; + function has(target: any, propertyKey: PropertyKey): boolean; function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; + function ownKeys(target: any): PropertyKey[]; function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: KeyOfProperty, value: any, receiver?: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; function setPrototypeOf(target: any, proto: any): boolean; } @@ -654,17 +650,17 @@ declare module "es6-shim" { namespace Reflect { function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; function construct(target: Function, argumentsList: ArrayLike): any; - function defineProperty(target: any, propertyKey: KeyOfProperty, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: KeyOfProperty): boolean; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; function enumerate(target: any): Iterator; - function get(target: any, propertyKey: KeyOfProperty, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: KeyOfProperty): PropertyDescriptor; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: KeyOfProperty): boolean; + function has(target: any, propertyKey: PropertyKey): boolean; function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; + function ownKeys(target: any): PropertyKey[]; function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: KeyOfProperty, value: any, receiver?: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; function setPrototypeOf(target: any, proto: any): boolean; } } diff --git a/types/es6-shim/package.json b/types/es6-shim/package.json deleted file mode 100644 index f2591ceb88..0000000000 --- a/types/es6-shim/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "private": true, - "types": "index", - "typesVersions": { - ">=3.1.0-0": { - "*": [ - "ts3.1/*" - ] - } - } -} diff --git a/types/es6-shim/ts3.1/es6-shim-tests.ts b/types/es6-shim/ts3.1/es6-shim-tests.ts deleted file mode 100644 index 9d564742dc..0000000000 --- a/types/es6-shim/ts3.1/es6-shim-tests.ts +++ /dev/null @@ -1,229 +0,0 @@ -interface Point { x: number; y: number; } -interface Point3D extends Point { z: number; } - -let a: any; -let s = ''; -let i = 2; -let iOrUndef: number | undefined; -let b: boolean; -let f: () => void = () => {}; -let o: Object; -let r: RegExp = /a/; -declare const sym: symbol; -let e: Error = new Error(); -let date: Date; -let key: PropertyKey; -let point: Point = { x: 1, y: 2 }; -let point3d: Point3D = { x: 1, y: 2, z: 3 }; -let point3dOrUndef: Point3D | undefined; -let pointOrUndef: Point | undefined; -let arrayOfPoint: Point[] = []; -let arrayOfPoint3D: Point3D[]; -let arrayOfSymbol: symbol[]; -let arrayOfPropertyKey: PropertyKey[]; -let arrayOfAny: any[]; -let arrayOfStringAny: Array<[string, any]>; -let arrayLikeOfAny: ArrayLike = []; -let iterableOfPoint: IterableShim = []; -let iterableOfStringPoint: IterableShim<[string, Point]> = []; -let iterableOfPointPoint3D: IterableShim<[Point, Point3D]> = []; -let iterableIteratorOfPoint: IterableIteratorShim; -let iterableIteratorOfNumberPoint: IterableIteratorShim<[number, Point]>; -let iterableIteratorOfNumber: IterableIteratorShim; -let iterableIteratorOfString: IterableIteratorShim; -let iterableIteratorOfPointPoint: IterableIteratorShim<[Point, Point]>; -let iterableIteratorOfNode: IterableIteratorShim; -let iterableIteratorOfStringPoint: IterableIteratorShim<[string, Point]>; -let iterableIteratorOfAny: IterableIteratorShim; -let iterableIteratorOfPropertyKey: IterableIteratorShim; -let iterableIteratorOfPropertyKeyPoint: IterableIteratorShim<[PropertyKey, Point]>; -let nodeList: NodeList; -let pd: PropertyDescriptor = {}; -let pdm: PropertyDescriptorMap = {}; -let map: Map = new Map(); -let set: Set = new Set(); -let weakMap: WeakMap = new WeakMap(); -let weakSet: WeakSet = new WeakSet(); -let promiseLikeOfPoint: PromiseLike = Promise.resolve(point); -let promiseLikeOfPoint3D: PromiseLike = Promise.resolve(point3d); -let promiseOfPoint: Promise = Promise.resolve(point); -let promiseOfPoint3D: Promise = Promise.resolve(point3d); -let promiseOfArrayOfPoint: Promise; -let promiseOfVoid: Promise; - -point = Object.assign(point, point); -b = Object.is(point, point); -Object.setPrototypeOf(point, {}); -pointOrUndef = arrayOfPoint.find(p => b); -i = arrayOfPoint.findIndex(p => b); -arrayOfPoint = arrayOfPoint.fill(point, i, arrayOfPoint.length); -arrayOfPoint = arrayOfPoint.copyWithin(i, i, i); -arrayOfPoint = Array.from(arrayOfPoint); -arrayOfPoint = Array.from(iterableOfPoint); -arrayOfPoint3D = Array.from(arrayOfPoint, point => point3d); -arrayOfPoint3D = Array.from(arrayOfPoint, point => point3d, a); -arrayOfPoint3D = Array.from(iterableOfPoint, point => point3d); -arrayOfPoint3D = Array.from(iterableOfPoint, point => point3d, a); -arrayOfPoint = Array.of(point, point); -i = s.codePointAt(i); -b = s.includes(s, i); -b = s.endsWith(s, i); -s = s.repeat(i); -b = s.startsWith(s, i); -s = String.fromCodePoint(2 as number, 3 as number); -s = String.raw`abc`; -s = r.flags; -i = Number.EPSILON; -b = Number.isFinite(i); -b = Number.isInteger(i); -b = Number.isNaN(i); -b = Number.isSafeInteger(i); -i = Number.MAX_SAFE_INTEGER; -i = Number.MIN_SAFE_INTEGER; -i = Number.parseFloat(s); -i = Number.parseInt(s, 10); -i = Number.parseInt(s, i); -i = Math.clz32(i); -i = Math.imul(i, i); -i = Math.sign(i); -i = Math.log10(i); -i = Math.log2(i); -i = Math.log1p(i); -i = Math.expm1(i); -i = Math.cosh(i); -i = Math.sinh(i); -i = Math.tanh(i); -i = Math.acosh(i); -i = Math.asinh(i); -i = Math.atanh(i); -i = Math.hypot(i, i); -i = Math.trunc(i); -i = Math.fround(i); -i = Math.cbrt(i); -map.clear(); -map.delete(s); -map.forEach((value: Point, key: string) => { }); -pointOrUndef = map.get(s); -b = map.has(s); -map = map.set(s, point); -i = map.size; -map = new Map(); -map = new Map(iterableOfStringPoint); -set.clear(); -set.delete(point); -set.forEach((value: Point, key: Point) => { }); -b = set.has(point); -set = set.add(point); -i = set.size; -set = new Set(); -set = new Set(iterableOfPoint); -weakMap.delete(point); -point3dOrUndef = weakMap.get(point); -b = weakMap.has(point); -weakMap = weakMap.set(point, point3d); -weakMap = new WeakMap(); -weakMap = new WeakMap(iterableOfPointPoint3D); -weakSet.delete(point); -weakSet = weakSet.add(point); -b = weakSet.has(point); -weakSet = new WeakSet(); -weakSet = new WeakSet(iterableOfPoint); -iterableIteratorOfNumberPoint = arrayOfPoint.entries(); -iterableIteratorOfNumber = arrayOfPoint.keys(); -iterableIteratorOfPoint = arrayOfPoint.values(); -iterableIteratorOfPointPoint = set.entries(); -iterableIteratorOfPoint = set.keys(); -iterableIteratorOfPoint = set.values(); -promiseLikeOfPoint.then((point: Point) => { }); -promiseLikeOfPoint = promiseLikeOfPoint.then(); -promiseLikeOfPoint = promiseLikeOfPoint.then(p => point); -promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint); -promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => point); -promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => point); -promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => promiseLikeOfPoint); -promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => { }); -promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => { }); -promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d); -promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D); -promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => point3d); -promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => point3d); -promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => promiseLikeOfPoint3D); -promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => { }); -promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => { }); -promiseOfPoint.then((point: Point) => { }); -promiseOfPoint = promiseOfPoint.then(); -promiseOfPoint = promiseOfPoint.then(p => point); -promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint); -promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint); -promiseOfPoint = promiseOfPoint.then(p => point, e => point); -promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => point); -promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => point); -promiseOfPoint = promiseOfPoint.then(p => point, e => promiseOfPoint); -promiseOfPoint = promiseOfPoint.then(p => point, e => promiseLikeOfPoint); -promiseOfPoint = promiseOfPoint.then(p => point, e => { }); -promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => { }); -promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => { }); -promiseOfPoint3D = promiseOfPoint.then(p => point3d); -promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D); -promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D); -promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => point3d); -promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => point3d); -promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => point3d); -promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseOfPoint3D); -promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseLikeOfPoint3D); -promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => { }); -promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => { }); -promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => { }); -promiseOfPoint = promiseOfPoint.catch(e => point); -promiseOfPoint = promiseOfPoint.catch(e => promiseOfPoint); -promiseOfPoint = promiseOfPoint.catch(e => promiseLikeOfPoint); -promiseOfPoint = promiseOfPoint.catch(e => { }); -promiseOfPoint3D = promiseOfPoint3D.catch(e => point3d); -promiseOfPoint3D = promiseOfPoint3D.catch(e => promiseOfPoint3D); -promiseOfPoint3D = promiseOfPoint3D.catch(e => promiseLikeOfPoint3D); -promiseOfPoint = new Promise((resolve, reject) => resolve(point)); -promiseOfPoint = new Promise((resolve, reject) => resolve(promiseOfPoint)); -promiseOfPoint = new Promise((resolve, reject) => resolve(promiseLikeOfPoint)); -promiseOfPoint = new Promise((resolve, reject) => reject(e)); -// To prevent UnhandledPromiseRejectionWarning -promiseOfPoint.catch(() => {}); -promiseOfArrayOfPoint = Promise.all(arrayOfPoint); -promiseOfArrayOfPoint = Promise.all(iterableOfPoint); -promiseOfPoint = Promise.race(arrayOfPoint); -promiseOfPoint = Promise.race(iterableOfPoint); -promiseOfVoid = Promise.resolve(); -promiseOfPoint = Promise.resolve(point3d); -promiseOfPoint = Promise.resolve(promiseOfPoint); -promiseOfPoint = Promise.resolve(promiseLikeOfPoint); -promiseOfVoid = Promise.reject(e); -// To prevent UnhandledPromiseRejectionWarning -promiseOfVoid.catch(() => {}); -promiseOfPoint = Promise.reject(e); -// To prevent UnhandledPromiseRejectionWarning -promiseOfPoint.catch(() => {}); -a = Reflect.apply(f, a, arrayLikeOfAny); -a = Reflect.construct(f, arrayLikeOfAny); -b = Reflect.defineProperty(a, s, pd); -b = Reflect.defineProperty(a, i, pd); -b = Reflect.defineProperty(a, sym, pd); -b = Reflect.deleteProperty(a, s); -b = Reflect.deleteProperty(a, i); -b = Reflect.deleteProperty(a, sym); -iterableIteratorOfAny = Reflect.enumerate(a); -Reflect.get(a, s, a); -Reflect.get(a, i, a); -Reflect.get(a, sym, a); -pd = Reflect.getOwnPropertyDescriptor(a, s); -pd = Reflect.getOwnPropertyDescriptor(a, i); -pd = Reflect.getOwnPropertyDescriptor(a, sym); -a = Reflect.getPrototypeOf(a); -b = Reflect.has(a, s); -b = Reflect.has(a, i); -b = Reflect.has(a, sym); -b = Reflect.isExtensible(a); -arrayOfPropertyKey = Reflect.ownKeys(a); -b = Reflect.preventExtensions(a); -b = Reflect.set(a, s, a, a); -b = Reflect.set(a, i, a, a); -b = Reflect.set(a, sym, a, a); -b = Reflect.setPrototypeOf(a, a); diff --git a/types/es6-shim/ts3.1/index.d.ts b/types/es6-shim/ts3.1/index.d.ts deleted file mode 100644 index b8f15230e3..0000000000 --- a/types/es6-shim/ts3.1/index.d.ts +++ /dev/null @@ -1,661 +0,0 @@ -interface IteratorResult { - done: boolean; - value?: T; -} - -interface IterableShim { - /** - * Shim for an ES6 iterable. Not intended for direct use by user code. - */ - "_es6-shim iterator_"(): Iterator; -} - -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - -interface IterableIteratorShim extends IterableShim, Iterator { - /** - * Shim for an ES6 iterable iterator. Not intended for direct use by user code. - */ - "_es6-shim iterator_"(): IterableIteratorShim; -} - -interface StringConstructor { - /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. - */ - fromCodePoint(...codePoints: number[]): string; - - /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. - */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} - -interface String { - /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. - */ - codePointAt(pos: number): number; - - /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. - */ - includes(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; - - /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append - */ - repeat(count: number): 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 an HTML anchor element and sets the name attribute to the text value - * @param name - */ - anchor(name: string): string; - - /** Returns a HTML element */ - big(): string; - - /** Returns a HTML element */ - blink(): string; - - /** Returns a HTML element */ - bold(): string; - - /** Returns a HTML element */ - fixed(): string; - - /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string; - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: number): string; - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: string): string; - - /** Returns an HTML element */ - italics(): string; - - /** Returns an HTML element and sets the href attribute value */ - link(url: string): string; - - /** Returns a HTML element */ - small(): string; - - /** Returns a HTML element */ - strike(): string; - - /** Returns a HTML element */ - sub(): string; - - /** Returns a HTML element */ - sup(): string; - - /** - * Shim for an ES6 iterable. Not intended for direct use by user code. - */ - "_es6-shim iterator_"(): IterableIteratorShim; -} - -interface ArrayConstructor { - /** - * Creates an array from an array-like 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(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; - - /** - * 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(iterable: IterableShim, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; - - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - */ - from(arrayLike: ArrayLike): T[]; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - */ - from(iterable: IterableShim): T[]; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: T[]): T[]; -} - -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: T[]) => boolean, thisArg?: any): T | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 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. - */ - findIndex(predicate: (value: T) => boolean, thisArg?: any): number; - - /** - * 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[]; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): T[]; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIteratorShim<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIteratorShim; - - /** - * Returns an list of values in the array - */ - values(): IterableIteratorShim; - - /** - * Shim for an ES6 iterable. Not intended for direct use by user code. - */ - "_es6-shim iterator_"(): IterableIteratorShim; -} - -interface NumberConstructor { - /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10‍−‍16. - */ - EPSILON: number; - - /** - * Returns true if passed value is finite. - * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. - */ - isFinite(number: number): boolean; - - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(number: number): boolean; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(number: number): boolean; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(number: number): boolean; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - MAX_SAFE_INTEGER: number; - - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). - */ - MIN_SAFE_INTEGER: number; - - /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ - parseFloat(string: string): number; - - /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface ObjectConstructor { - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects to copy properties from. - */ - assign(target: any, ...sources: any[]): any; - - /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. - */ - is(value1: any, value2: any): boolean; - - /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. - * @remarks Requires `__proto__` support. - */ - setPrototypeOf(o: any, proto: any): any; -} - -interface RegExp { - /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. - */ - flags: string; -} - -interface Math { - /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. - */ - clz32(x: number): number; - - /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number - */ - imul(x: number, y: number): number; - - /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test - */ - sign(x: number): number; - - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. - */ - log10(x: number): number; - - /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. - */ - log2(x: number): number; - - /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; - - /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. - */ - expm1(x: number): number; - - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cosh(x: number): number; - - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sinh(x: number): number; - - /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tanh(x: number): number; - - /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - acosh(x: number): number; - - /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - asinh(x: number): number; - - /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - atanh(x: number): number; - - /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * 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; - - /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. - */ - trunc(x: number): number; - - /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. - */ - fround(x: number): number; - - /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. - */ - cbrt(x: number): number; -} - -interface PromiseLike { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; -} - -/** - * Represents the completion of an asynchronous operation - */ -interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: (reason: any) => T | PromiseLike): Promise; - catch(onrejected?: (reason: any) => void): Promise; -} - -interface PromiseConstructor { - /** - * A reference to the prototype. - */ - prototype: Promise; - - /** - * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used to resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: IterableShim>): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: IterableShim>): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; -} - -declare var Promise: PromiseConstructor; - -interface Map { - clear(): void; - delete(key: K): boolean; - forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - get(key: K): V | undefined; - has(key: K): boolean; - set(key: K, value: V): Map; - size: number; - entries(): IterableIteratorShim<[K, V]>; - keys(): IterableIteratorShim; - values(): IterableIteratorShim; -} - -interface MapConstructor { - new (): Map; - new (iterable: IterableShim<[K, V]>): Map; - prototype: Map; -} - -declare var Map: MapConstructor; - -interface Set { - add(value: T): Set; - clear(): void; - delete(value: T): boolean; - forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - size: number; - entries(): IterableIteratorShim<[T, T]>; - keys(): IterableIteratorShim; - values(): IterableIteratorShim; - '_es6-shim iterator_'(): IterableIteratorShim; -} - -interface SetConstructor { - new (): Set; - new (iterable: IterableShim): Set; - prototype: Set; -} - -declare var Set: SetConstructor; - -interface WeakMap { - delete(key: K): boolean; - get(key: K): V | undefined; - has(key: K): boolean; - set(key: K, value: V): WeakMap; -} - -interface WeakMapConstructor { - new (): WeakMap; - new (iterable: IterableShim<[K, V]>): WeakMap; - prototype: WeakMap; -} - -declare var WeakMap: WeakMapConstructor; - -interface WeakSet { - add(value: T): WeakSet; - delete(value: T): boolean; - has(value: T): boolean; -} - -interface WeakSetConstructor { - new (): WeakSet; - new (iterable: IterableShim): WeakSet; - prototype: WeakSet; -} - -declare var WeakSet: WeakSetConstructor; - -declare namespace Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function enumerate(target: any): IterableIteratorShim; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: PropertyKey): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): PropertyKey[]; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; -} - -declare module "es6-shim" { - var String: StringConstructor; - var Array: ArrayConstructor; - var Number: NumberConstructor; - var Math: Math; - var Object: ObjectConstructor; - var Map: MapConstructor; - var Set: SetConstructor; - var WeakMap: WeakMapConstructor; - var WeakSet: WeakSetConstructor; - var Promise: PromiseConstructor; - namespace Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function enumerate(target: any): Iterator; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: PropertyKey): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): PropertyKey[]; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; - } -} diff --git a/types/es6-shim/ts3.1/tsconfig.json b/types/es6-shim/ts3.1/tsconfig.json deleted file mode 100644 index e652a67caa..0000000000 --- a/types/es6-shim/ts3.1/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es5", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "es6-shim-tests.ts" - ] -} diff --git a/types/es6-shim/ts3.1/tslint.json b/types/es6-shim/ts3.1/tslint.json deleted file mode 100644 index 718da444d0..0000000000 --- a/types/es6-shim/ts3.1/tslint.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "ban-types": false, - "jsdoc-format": false, - "no-single-declare-module": false, - "no-unnecessary-generics": false, - "no-var-keyword": false, - "prefer-object-spread": false, - "unified-signatures": false - } -} diff --git a/types/es6-shim/tslint.json b/types/es6-shim/tslint.json index c9bb5473ae..3587d09f29 100644 --- a/types/es6-shim/tslint.json +++ b/types/es6-shim/tslint.json @@ -1,24 +1,14 @@ { "extends": "dtslint/dt.json", "rules": { - "array-type": false, "ban-types": false, - "callable-types": false, "dt-header": false, "jsdoc-format": false, "no-declare-current-package": false, - "no-inferrable-types": false, - "no-object-literal-type-assertion": false, - "no-redundant-jsdoc": false, "no-single-declare-module": false, "no-unnecessary-generics": false, "no-var-keyword": false, - "no-var-requires": false, - "prefer-method-signature": false, "prefer-object-spread": false, - "radix": false, - "semicolon": false, - "strict-export-declare-modifiers": false, "unified-signatures": false } }