From 158f0715ab75c32dcef74c361b64d79a1fa305b9 Mon Sep 17 00:00:00 2001 From: Tadeusz Hucal Date: Sat, 3 Oct 2015 18:58:28 +0200 Subject: [PATCH 001/107] Restangular: restore synchronization with Angular's request configuration --- restangular/restangular.d.ts | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/restangular/restangular.d.ts b/restangular/restangular.d.ts index b09e4affd0..b407cefd4d 100644 --- a/restangular/restangular.d.ts +++ b/restangular/restangular.d.ts @@ -29,17 +29,6 @@ declare module restangular { $object: T[]; } - interface IRequestConfig { - params?: any; - headers?: any; - cache?: any; - withCredentials?: boolean; - data?: any; - transformRequest?: any; - transformResponse?: any; - timeout?: any; // number | promise - } - interface IResponse { status: number; data: any; @@ -65,8 +54,8 @@ declare module restangular { addResponseInterceptor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: ng.IDeferred) => any): void; setRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string) => any): void; addRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string) => any): void; - setFullRequestInterceptor(fullRequestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: IRequestConfig) => {element: any; headers: any; params: any}): void; - addFullRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: IRequestConfig) => {headers: any; params: any; element: any; httpConfig: IRequestConfig}): void; + setFullRequestInterceptor(fullRequestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: ng.IRequestShortcutConfig) => {element: any; headers: any; params: any}): void; + addFullRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: ng.IRequestShortcutConfig) => {headers: any; params: any; element: any; httpConfig: ng.IRequestShortcutConfig}): void; setErrorInterceptor(errorInterceptor: (response: IResponse, deferred: ng.IDeferred) => any): void; setRestangularFields(fields: {[fieldName: string]: string}): void; setMethodOverriders(overriders: string[]): void; @@ -124,7 +113,7 @@ declare module restangular { clone(): IElement; plain(): any; plain(): T; - withHttpConfig(httpConfig: IRequestConfig): IElement; + withHttpConfig(httpConfig: ng.IRequestShortcutConfig): IElement; save(queryParams?: any, headers?: any): IPromise; getRestangularUrl(): string; } @@ -139,7 +128,7 @@ declare module restangular { options(queryParams?: any, headers?: any): IPromise; patch(queryParams?: any, headers?: any): IPromise; putElement(idx: any, params: any, headers: any): IPromise; - withHttpConfig(httpConfig: IRequestConfig): ICollection; + withHttpConfig(httpConfig: ng.IRequestShortcutConfig): ICollection; clone(): ICollection; plain(): any; plain(): T[]; From 640536586ae4f3a7db43b041a44caf64021c7610 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Thu, 15 Oct 2015 15:17:03 +0300 Subject: [PATCH 002/107] flux-utils definitions added. --- flux/flux-utils.d.ts | 130 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 flux/flux-utils.d.ts diff --git a/flux/flux-utils.d.ts b/flux/flux-utils.d.ts new file mode 100644 index 0000000000..8437f9d4b5 --- /dev/null +++ b/flux/flux-utils.d.ts @@ -0,0 +1,130 @@ +// Type definitions for Flux/utils +// Project: http://facebook.github.io/flux/ +// Definitions by: Giedrius Grabauskas +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module FluxUtils { + + export class Container { + /** + * Create is used to transform a react class into a container + * that updates its state when relevant stores change. + * The provided base class must have static methods getStores() and calculateState(). + */ + static create(base: React.ComponentClass, options?: Object): React.ComponentClass; + } + + /** + * This class extends ReduceStore and defines the state as an immutable map. + */ + export class MapStore extends ReduceStore> { + + /** + * Access the value at the given key. + * Throws an error if the key does not exist in the cache. + */ + at(key: K): V; + + /** + * Check if the cache has a particular key + */ + has(key: K): boolean; + + /** + * Get the value of a particular key. + * Returns undefined if the key does not exist in the cache. + */ + get(key: K): V; + + /** + * Gets an array of keys and puts the values in a map if they exist, + * it allows providing a previous result to update instead of generating a new map. + * Providing a previous result allows the possibility of keeping the same reference if the keys did not change. + */ + getAll(keys: Iterable, prev?: Immutable.Map): Immutable.Map; + } + + export class ReduceStore extends Store { + /** + * Getter that exposes the entire state of this store. + * If your state is not immutable you should override this and not expose state directly. + */ + getState(): T; + + /** + * Constructs the initial state for this store. + * This is called once during construction of the store. + */ + getInitialState(): T; + + /** + * Reduces the current state, and an action to the new state of this store. + * All subclasses must implement this method. + * This method should be pure and have no side-effects. + */ + reduce(state: T, action: Object): T; + + /** + * Checks if two versions of state are the same. + * You do not need to override this if your state is immutable. + */ + areEqual(one: T, two: T): boolean; + + } + + export class Store { + + /** + * Constructs and registers an instance of this store with the given dispatcher. + */ + constructor(dispatcher: Flux.Dispatcher); + + /** + * Adds a listener to the store, when the store changes the given callback will be called. + * A token is returned that can be used to remove the listener. + * Calling the remove() function on the returned token will remove the listener. + */ + addListener(callback: Function): { remove: Function }; + + /** + * Returns the dispatcher this store is registered with. + */ + getDispatcher(): Flux.Dispatcher; + + /** + * Returns the dispatch token that the dispatcher recognizes this store by. + * Can be used to waitFor() this store. + */ + getDispatchToken(): string; + + /** + * Ask if a store has changed during the current dispatch. + * Can only be invoked while dispatching. + * This can be used for constructing derived stores that depend on data from other stores. + */ + hasChanged(): boolean; + + /** + *Emit an event notifying all listeners that this store has changed. + * This can only be invoked when dispatching. + * Changes are de-duplicated and resolved at the end of this store's __onDispatch function. + */ + __emitChange(): void; + + /** + * Subclasses must override this method. + * This is how the store receives actions from the dispatcher. + * All state mutation logic must be done during this method. + */ + __onDispatch(payload: Object): void; + } + + + +} + +declare module 'flux/utils' { + export = FluxUtils; +} From 438f5535c7f5cc7653cceb91d1d3a7f85b82a507 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Mon, 19 Oct 2015 18:55:20 +0300 Subject: [PATCH 003/107] Delete flux-utils.d.ts --- flux/flux-utils.d.ts | 130 ------------------------------------------- 1 file changed, 130 deletions(-) delete mode 100644 flux/flux-utils.d.ts diff --git a/flux/flux-utils.d.ts b/flux/flux-utils.d.ts deleted file mode 100644 index 8437f9d4b5..0000000000 --- a/flux/flux-utils.d.ts +++ /dev/null @@ -1,130 +0,0 @@ -// Type definitions for Flux/utils -// Project: http://facebook.github.io/flux/ -// Definitions by: Giedrius Grabauskas -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module FluxUtils { - - export class Container { - /** - * Create is used to transform a react class into a container - * that updates its state when relevant stores change. - * The provided base class must have static methods getStores() and calculateState(). - */ - static create(base: React.ComponentClass, options?: Object): React.ComponentClass; - } - - /** - * This class extends ReduceStore and defines the state as an immutable map. - */ - export class MapStore extends ReduceStore> { - - /** - * Access the value at the given key. - * Throws an error if the key does not exist in the cache. - */ - at(key: K): V; - - /** - * Check if the cache has a particular key - */ - has(key: K): boolean; - - /** - * Get the value of a particular key. - * Returns undefined if the key does not exist in the cache. - */ - get(key: K): V; - - /** - * Gets an array of keys and puts the values in a map if they exist, - * it allows providing a previous result to update instead of generating a new map. - * Providing a previous result allows the possibility of keeping the same reference if the keys did not change. - */ - getAll(keys: Iterable, prev?: Immutable.Map): Immutable.Map; - } - - export class ReduceStore extends Store { - /** - * Getter that exposes the entire state of this store. - * If your state is not immutable you should override this and not expose state directly. - */ - getState(): T; - - /** - * Constructs the initial state for this store. - * This is called once during construction of the store. - */ - getInitialState(): T; - - /** - * Reduces the current state, and an action to the new state of this store. - * All subclasses must implement this method. - * This method should be pure and have no side-effects. - */ - reduce(state: T, action: Object): T; - - /** - * Checks if two versions of state are the same. - * You do not need to override this if your state is immutable. - */ - areEqual(one: T, two: T): boolean; - - } - - export class Store { - - /** - * Constructs and registers an instance of this store with the given dispatcher. - */ - constructor(dispatcher: Flux.Dispatcher); - - /** - * Adds a listener to the store, when the store changes the given callback will be called. - * A token is returned that can be used to remove the listener. - * Calling the remove() function on the returned token will remove the listener. - */ - addListener(callback: Function): { remove: Function }; - - /** - * Returns the dispatcher this store is registered with. - */ - getDispatcher(): Flux.Dispatcher; - - /** - * Returns the dispatch token that the dispatcher recognizes this store by. - * Can be used to waitFor() this store. - */ - getDispatchToken(): string; - - /** - * Ask if a store has changed during the current dispatch. - * Can only be invoked while dispatching. - * This can be used for constructing derived stores that depend on data from other stores. - */ - hasChanged(): boolean; - - /** - *Emit an event notifying all listeners that this store has changed. - * This can only be invoked when dispatching. - * Changes are de-duplicated and resolved at the end of this store's __onDispatch function. - */ - __emitChange(): void; - - /** - * Subclasses must override this method. - * This is how the store receives actions from the dispatcher. - * All state mutation logic must be done during this method. - */ - __onDispatch(payload: Object): void; - } - - - -} - -declare module 'flux/utils' { - export = FluxUtils; -} From 3d4207f11f34df6bcc5cdbece92b69fffed8fde6 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Mon, 19 Oct 2015 18:56:13 +0300 Subject: [PATCH 004/107] Update flux.d.ts Content moved from flux-utils.d.ts --- flux/flux.d.ts | 122 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/flux/flux.d.ts b/flux/flux.d.ts index bf5bafac4b..8a00eb1e1f 100644 --- a/flux/flux.d.ts +++ b/flux/flux.d.ts @@ -65,3 +65,125 @@ declare module Flux { declare module "flux" { export = Flux; } + +declare module FluxUtils { + + export class Container { + constructor(); + /** + * Create is used to transform a react class into a container + * that updates its state when relevant stores change. + * The provided base class must have static methods getStores() and calculateState(). + */ + static create(base: React.ComponentClass, options?: Object): React.ComponentClass; + } + + /** + * This class extends ReduceStore and defines the state as an immutable map. + */ + export class MapStore extends ReduceStore> { + + /** + * Access the value at the given key. + * Throws an error if the key does not exist in the cache. + */ + at(key: K): V; + + /** + * Check if the cache has a particular key + */ + has(key: K): boolean; + + /** + * Get the value of a particular key. + * Returns undefined if the key does not exist in the cache. + */ + get(key: K): V; + + /** + * Gets an array of keys and puts the values in a map if they exist, + * it allows providing a previous result to update instead of generating a new map. + * Providing a previous result allows the possibility of keeping the same reference if the keys did not change. + */ + getAll(keys: Immutable.IndexedIterable, prev?: Immutable.Map): Immutable.Map; + } + + export class ReduceStore extends Store { + /** + * Getter that exposes the entire state of this store. + * If your state is not immutable you should override this and not expose state directly. + */ + getState(): T; + + /** + * Constructs the initial state for this store. + * This is called once during construction of the store. + */ + getInitialState(): T; + + /** + * Reduces the current state, and an action to the new state of this store. + * All subclasses must implement this method. + * This method should be pure and have no side-effects. + */ + reduce(state: T, action: Object): T; + + /** + * Checks if two versions of state are the same. + * You do not need to override this if your state is immutable. + */ + areEqual(one: T, two: T): boolean; + + } + + export class Store { + + /** + * Constructs and registers an instance of this store with the given dispatcher. + */ + constructor(dispatcher: Flux.Dispatcher); + + /** + * Adds a listener to the store, when the store changes the given callback will be called. + * A token is returned that can be used to remove the listener. + * Calling the remove() function on the returned token will remove the listener. + */ + addListener(callback: Function): { remove: Function }; + + /** + * Returns the dispatcher this store is registered with. + */ + getDispatcher(): Flux.Dispatcher; + + /** + * Returns the dispatch token that the dispatcher recognizes this store by. + * Can be used to waitFor() this store. + */ + getDispatchToken(): string; + + /** + * Ask if a store has changed during the current dispatch. + * Can only be invoked while dispatching. + * This can be used for constructing derived stores that depend on data from other stores. + */ + hasChanged(): boolean; + + /** + *Emit an event notifying all listeners that this store has changed. + * This can only be invoked when dispatching. + * Changes are de-duplicated and resolved at the end of this store's __onDispatch function. + */ + __emitChange(): void; + + /** + * Subclasses must override this method. + * This is how the store receives actions from the dispatcher. + * All state mutation logic must be done during this method. + */ + __onDispatch(payload: Object): void; + } +} + +declare module 'flux/utils' { + export = FluxUtils; +} From 96173498302aeab1a726f8927bc7314d0b42db85 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Mon, 19 Oct 2015 19:06:19 +0300 Subject: [PATCH 005/107] Added references Added immutable and react references. --- flux/flux.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flux/flux.d.ts b/flux/flux.d.ts index 8a00eb1e1f..5b6079d50b 100644 --- a/flux/flux.d.ts +++ b/flux/flux.d.ts @@ -1,8 +1,11 @@ // Type definitions for Flux // Project: http://facebook.github.io/flux/ -// Definitions by: Steve Baker +// Definitions by: Steve Baker , Giedrius Grabauskas // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// +/// + declare module Flux { /** From 506e79788f825cc28f54c11466ae3ec7828de830 Mon Sep 17 00:00:00 2001 From: dencap Date: Thu, 12 Nov 2015 15:30:55 +0100 Subject: [PATCH 006/107] Added definition for bytebuffer.js (with long.js) --- bytebuffer/bytebuffer.d.ts | 612 +++++++++++++++++++++++++++++++++++++ bytebuffer/long.d.ts | 349 +++++++++++++++++++++ 2 files changed, 961 insertions(+) create mode 100644 bytebuffer/bytebuffer.d.ts create mode 100644 bytebuffer/long.d.ts diff --git a/bytebuffer/bytebuffer.d.ts b/bytebuffer/bytebuffer.d.ts new file mode 100644 index 0000000000..6123ed50bd --- /dev/null +++ b/bytebuffer/bytebuffer.d.ts @@ -0,0 +1,612 @@ +// Type definitions for ByteBuffer.js 5.0.0 +// Project: https://github.com/dcodeIO/bytebuffer.js + +/// + +declare class ByteBuffer +{ + /** + * Constructs a new ByteBuffer. + */ + constructor( capacity?: number, littleEndian?: boolean, noAssert?: boolean ); + + /** + * Big endian constant that can be used instead of its boolean value. Evaluates to false. + */ + static BIG_ENDIAN: boolean; + + /** + * Default initial capacity of 16. + */ + static DEFAULT_CAPACITY: number; + + /** + * Default no assertions flag of false. + */ + static DEFAULT_NOASSERT + + /** + * Little endian constant that can be used instead of its boolean value. Evaluates to true. + */ + static LITTLE_ENDIAN: boolean; + + /** + * Maximum number of bytes required to store a 32bit base 128 variable-length integer. + */ + static MAX_VARINT32_BYTES: number; + + /** + * Maximum number of bytes required to store a 64bit base 128 variable-length integer. + */ + static MAX_VARINT64_BYTES: number; + + /** + * Metrics representing number of bytes.Evaluates to 2. + */ + static METRICS_BYTES: number; + + /** + * Metrics representing number of UTF8 characters.Evaluates to 1. + */ + static METRICS_CHARS + + /** + * ByteBuffer version. + */ + static VERSION: string; + + /** + * Backing buffer. + */ + buffer: ArrayBuffer; + + /** + * Absolute limit of the contained data. Set to the backing buffer's capacity upon allocation. + */ + limit: number; + + /** + * Whether to use little endian byte order, defaults to false for big endian. + */ + littleEndian: boolean; + + /** + * Marked offset. + */ + markedOffset: number; + + /** + * Whether to skip assertions of offsets and values, defaults to false. + */ + noAssert: boolean; + + /** + * Absolute read/write offset. + */ + offset: number; + + /** + * Data view to manipulate the backing buffer. Becomes null if the backing buffer has a capacity of 0. + */ + view: DataView; + + /** + * Allocates a new ByteBuffer backed by a buffer of the specified capacity. + */ + static allocate( capacity?: number, littleEndian?: number, noAssert?: boolean ): ByteBuffer; + + /** + * Decodes a base64 encoded string to binary like window.atob does. + */ + static atob( b64: string ): string; + + /** + * Encodes a binary string to base64 like window.btoa does. + */ + static btoa( str: string ): string; + + /** + * Calculates the number of UTF8 bytes of a string. + */ + static calculateUTF8Byte( str: string ): number; + + /** + * Calculates the number of UTF8 characters of a string.JavaScript itself uses UTF- 16, so that a string's length property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF. + */ + static calculateUTF8Char( str: string ): number; + + /** + * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer. + */ + static calculateVariant32( value: number ): number; + + /** + * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer. + */ + static calculateVariant64( value: number | Long ): number; + + /** + * Concatenates multiple ByteBuffers into one. + */ + static concat( buffers: Array | ArrayBuffer | Uint8Array | string, encoding?: string | boolean, litteEndian?: boolean, noAssert?: boolean ): ByteBuffer; + + /** + * Decodes a base64 encoded string to a ByteBuffer. + */ + static fromBase64( str: string, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer; + + /** + * Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteBuffer. + */ + static fromBinary( str: string, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer; + + /** + * Decodes a hex encoded string with marked offsets to a ByteBuffer. + */ + static fromDebug( str: string, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer; + + /** + * Decodes a hex encoded string to a ByteBuffer. + */ + static fromHex( str: string, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer; + + /** + * Decodes an UTF8 encoded string to a ByteBuffer. + */ + static fromUTF8( str: string, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer; + + /** + * Gets the backing buffer type. + */ + static isByteBuffer( bb: any ): boolean; + + /** + * Wraps a buffer or a string. Sets the allocated ByteBuffer's ByteBuffer#offset to 0 and its ByteBuffer#limit to the length of the wrapped data. + * @param buffer Anything that can be wrapped + * @param encoding String encoding if buffer is a string ("base64", "hex", "binary", defaults to "utf8") + * @param littleEndian Whether to use little or big endian byte order. Defaults to ByteBuffer.DEFAULT_ENDIAN. + * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteBuffer.DEFAULT_NOASSERT. + */ + static wrap( buffer: ByteBuffer | ArrayBuffer | Uint8Array | string, enc?: string | boolean, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer; + + /** + * Decodes a zigzag encoded signed 32bit integer. + */ + static zigZagDecode32( n: number ): number; + + /** + * Decodes a zigzag encoded signed 64bit integer. + */ + static zigZagDecode64( n: number | Long ): Long; + + /** + * Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding. + */ + static zigZagEncode32( n: number ): number; + + /** + * Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding. + */ + static zigZagEncode64( n: number | Long ): Long; + + /** + * Switches (to) big endian byte order. + */ + BE( bigEndian?: boolean ): ByteBuffer; + + /** + * Switches (to) little endian byte order. + */ + LE( bigEndian?: boolean ): ByteBuffer; + + /** + * Appends some data to this ByteBuffer. This will overwrite any contents behind the specified offset up to the appended data's length. + */ + append( source: ByteBuffer | ArrayBuffer | Uint8Array | string, encoding?: string | number, offset?: number ): ByteBuffer; + + /** + * Appends this ByteBuffer's contents to another ByteBuffer. This will overwrite any contents behind the specified offset up to the length of this ByteBuffer's data. + */ + appendTo( target: ByteBuffer, offset?: number ): ByteBuffer; + + /** + * Enables or disables assertions of argument types and offsets. Assertions are enabled by default but you can opt to disable them if your code already makes sure that everything is valid. + */ + assert( assert: boolean ): ByteBuffer; + + /** + * Gets the capacity of this ByteBuffer's backing buffer. + */ + capacity(): number; + + /** + * Clears this ByteBuffer's offsets by setting ByteBuffer#offset to 0 and + * ByteBuffer#limit to the backing buffer's capacity. Discards ByteBuffer#markedOffset. + */ + clear(): ByteBuffer; + + /** + * Creates a cloned instance of this ByteBuffer, preset with this ByteBuffer's values for ByteBuffer#offset, ByteBuffer#markedOffset and ByteBuffer#limit. + */ + clone( copy?: boolean ): ByteBuffer; + + /** + * Compacts this ByteBuffer to be backed by a ByteBuffer#buffer of its contents' length. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit. Will set offset = 0 and limit = capacity and adapt ByteBuffer#markedOffset to the same relative position if set. + */ + compact( begin?: number, end?: number ): ByteBuffer; + + /** + * Creates a copy of this ByteBuffer's contents. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit. + */ + copy( begin?: number, end?: number ): ByteBuffer; + + /** + * Copies this ByteBuffer's contents to another ByteBuffer. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit. + */ + copyTo( target: ByteBuffer, targetOffset?: number, sourceOffset?: number, sourceLimit?: number ): ByteBuffer; + + /** + * Makes sure that this ByteBuffer is backed by a ByteBuffer#buffer of at least the specified capacity. If the current capacity is exceeded, it will be doubled. If double the current capacity is less than the required capacity, the required capacity will be used instead. + */ + ensureCapacity( capacity: number ): ByteBuffer; + + /** + * Overwrites this ByteBuffer's contents with the specified value. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit. + */ + fill( value: number | string, begin?: number, end?: number ): ByteBuffer; + + /** + * Makes this ByteBuffer ready for a new sequence of write or relative read operations. Sets limit = offset and offset = 0. Make sure always to flip a ByteBuffer when all relative read or write operations are complete. + */ + flip(): ByteBuffer; + + /** + * Marks an offset on this ByteBuffer to be used later. + */ + mark( offset?: number ): ByteBuffer; + + /** + * Sets the byte order. + */ + order( littleEndian: boolean ): ByteBuffer; + + /** + * Prepends some data to this ByteBuffer. This will overwrite any contents before the specified offset up to the prepended data's length. If there is not enough space available before the specified offset, the backing buffer will be resized and its contents moved accordingly. + */ + prepend( source: ByteBuffer | string | ArrayBuffer, encoding?: string | number, offset?: number ): ByteBuffer; + + /** + * Prepends this ByteBuffer to another ByteBuffer. This will overwrite any contents before the specified offset up to the prepended data's length. If there is not enough space available before the specified offset, the backing buffer will be resized and its contents moved accordingly. + */ + prependTo( target: ByteBuffer, offset?: number ): ByteBuffer; + + /** + * Prints debug information about this ByteBuffer's contents. + */ + printDebug( out?: ( string ) => void ): void; + + /** + * Reads an 8bit signed integer. This is an alias of ByteBuffer#readInt8. + */ + readByte( offset?: number ): number; + + /** + * Reads a NULL-terminated UTF8 encoded string. For this to work the string read must not contain any NULL characters itself. + */ + readCString( offset?: number ): string; + + /** + * Reads a 64bit float. This is an alias of ByteBuffer#readFloat64. + */ + readDouble( offset?: number ): number; + + /** + * Reads a 32bit float. This is an alias of ByteBuffer#readFloat32. + */ + readFloat( offset?: number ): number; + + /** + * Reads a 32bit float. + */ + readFloat32( offset?: number ): number; + + /** + * Reads a 64bit float. + */ + readFloat64( offset?: number ): number; + + /** + * Reads a length as uint32 prefixed UTF8 encoded string. + */ + readIString( offset?: number ): string; + + /** + * Reads a 32bit signed integer.This is an alias of ByteBuffer#readInt32. + */ + readInt( offset?: number ): number; + + /** + * Reads a 16bit signed integer. + */ + readInt16( offset?: number ): number; + + /** + * Reads a 32bit signed integer. + */ + readInt32( offset?: number ): number; + + /** + * Reads a 64bit signed integer. + */ + readInt64( offset?: number ): Long; + + /** + * Reads an 8bit signed integer. + */ + readInt8( offset?: number ): number; + + /** + * Reads a 64bit signed integer. This is an alias of ByteBuffer#readInt64. + */ + readLong( offset?: number ): Long; + + /** + * Reads a 16bit signed integer. This is an alias of ByteBuffer#readInt16. + */ + readShort( offset?: number ): number; + + /** + * Reads an UTF8 encoded string. This is an alias of ByteBuffer#readUTF8String. + */ + readString( length: number, metrics?: number, offset?: number ): string; + + /** + * Reads an UTF8 encoded string. + */ + readUTF8String( chars: number, offset?: number ): string; + + /** + * Reads a 16bit unsigned integer. + */ + readUint16( offset?: number ): number; + + /** + * Reads a 32bit unsigned integer. + */ + readUint32( offset?: number ): number; + + /** + * Reads a 64bit unsigned integer. + */ + readUint64( offset?: number ): Long; + /** + * Reads an 8bit unsigned integer. + */ + readUint8( offset?: number ): number; + + /** + * Reads a length as varint32 prefixed UTF8 encoded string. + */ + readVString( offset?: number ): string; + + /** + * Reads a 32bit base 128 variable-length integer. + */ + readVarint32( offset?: number ): number; + + /** + * Reads a zig-zag encoded 32bit base 128 variable-length integer. + */ + readVarint32ZiZag( offset?: number ): number; + + /** + * Reads a 64bit base 128 variable-length integer. Requires Long.js. + */ + readVarint64( offset?: number ): Long; + + /** + * Reads a zig-zag encoded 64bit base 128 variable-length integer. Requires Long.js. + */ + readVarint64ZigZag( offset?: number ): Long; + + /** + * Gets the number of remaining readable bytes. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit, so this returns limit - offset. + */ + remaining(): number; + + /** + * Resets this ByteBuffer's ByteBuffer#offset. If an offset has been marked through ByteBuffer#mark before, offset will be set to ByteBuffer#markedOffset, which will then be discarded. If no offset has been marked, sets offset = 0. + */ + reset(): ByteBuffer; + + /** + * Resizes this ByteBuffer to be backed by a buffer of at least the given capacity. Will do nothing if already that large or larger. + */ + resize( capacity: number ): ByteBuffer; + + /** + * Reverses this ByteBuffer's contents + */ + reverse( begin?: number, end?: number ): ByteBuffer; + + /** + * Skips the next length bytes. This will just advance + */ + skip( length: number ): ByteBuffer; + + /** + * Slices this ByteBuffer by creating a cloned instance with offset = begin and limit = end. + */ + slice( begin?: number, end?: number ): ByteBuffer; + + /** + * Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit. Will transparently ByteBuffer#flip this ByteBuffer if offset > limit but the actual offsets remain untouched. This is an alias of ByteBuffer#toBuffer. + */ + toArrayBuffer( forceCopy?: boolean ): ArrayBuffer; + + /** + * Encodes this ByteBuffer's contents to a base64 encoded string. + */ + toBase64( begin?: number, end?: number ): string; + + /** + * Encodes this ByteBuffer to a binary encoded string, that is using only characters 0x00-0xFF as bytes. + */ + toBinary( begin?: number, end?: number ): string; + + /** + * Returns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit. Will transparently ByteBuffer#flip this ByteBuffer if offset > limit but the actual offsets remain untouched. + */ + toBuffer( forceCopy?: boolean ): ArrayBuffer; + + /** + *Encodes this ByteBuffer to a hex encoded string with marked offsets. Offset symbols are: + * < : offset, + * ' : markedOffset, + * > : limit, + * | : offset and limit, + * [ : offset and markedOffset, + * ] : markedOffset and limit, + * ! : offset, markedOffset and limit + */ + toDebug( columns?: boolean ): string | Array + + /** + * Encodes this ByteBuffer's contents to a hex encoded string. + */ + toHex( begin?: number, end?: number ): string; + + /** + * Converts the ByteBuffer's contents to a string. + */ + toString( encoding?: string ): string; + + /** + * Encodes this ByteBuffer's contents between ByteBuffer#offset and ByteBuffer#limit to an UTF8 encoded string. + */ + toUTF8(): string; + + /** + * Writes an 8bit signed integer. This is an alias of ByteBuffer#writeInt8. + */ + writeByte( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a NULL-terminated UTF8 encoded string. For this to work the specified string must not contain any NULL characters itself. + */ + writeCString( str: string, offset?: number ): ByteBuffer; + + /** + * Writes a 64bit float. This is an alias of ByteBuffer#writeFloat64. + */ + writeDouble( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 32bit float. This is an alias of ByteBuffer#writeFloat32. + */ + writeFloat( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 32bit float. + */ + writeFloat32( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 64bit float. + */ + writeFloat64( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a length as uint32 prefixed UTF8 encoded string. + */ + writeIString( str: string, offset?: number ): ByteBuffer; + + /** + * Writes a 32bit signed integer. This is an alias of ByteBuffer#writeInt32. + */ + writeInt( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 16bit signed integer. + */ + writeInt16( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 32bit signed integer. + */ + writeInt32( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 64bit signed integer. + */ + writeInt64( value: number | Long, offset?: number ): ByteBuffer; + + /** + * Writes an 8bit signed integer. + */ + writeInt8( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 16bit signed integer. This is an alias of ByteBuffer#writeInt16. + */ + writeShort( value: number, offset?: number ): ByteBuffer; + + /** + * Writes an UTF8 encoded string.This is an alias of ByteBuffer#writeUTF8String. + */ + WriteString( str: string, offset?: number ): ByteBuffer | number; + + /** + * Writes an UTF8 encoded string. + */ + writeUTF8String( str: string, offset?: number ): ByteBuffer | number; + + /** + * Writes a 16bit unsigned integer. + */ + writeUint16( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 32bit unsigned integer. + */ + writeUint32( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a 64bit unsigned integer. + */ + writeUint64( value: number | Long, offset?: number ): ByteBuffer; + + /** + * Writes an 8bit unsigned integer. + */ + writeUint8( value: number, offset?: number ): ByteBuffer; + + /** + * Writes a length as varint32 prefixed UTF8 encoded string. + */ + writeVString( str: string, offset?: number ): ByteBuffer | number; + + /** + * Writes a 32bit base 128 variable-length integer. + */ + writeVarint32( value: number, offset?: number ): ByteBuffer | number; + + /** + * Writes a zig-zag encoded 32bit base 128 variable-length integer. + */ + writeVarint32ZigZag( value: number, offset?: number ): ByteBuffer | number; + + /** + * Writes a 64bit base 128 variable-length integer. + */ + writeVarint64( value: number | Long, offset?: number ): ByteBuffer; + + /** + * Writes a zig-zag encoded 64bit base 128 variable-length integer. + */ + writeVarint64ZigZag( value: number | Long, offset?: number ): ByteBuffer | number; +} + +declare module 'bytebuffer' { + export = ByteBuffer; +} diff --git a/bytebuffer/long.d.ts b/bytebuffer/long.d.ts new file mode 100644 index 0000000000..f5825ffe71 --- /dev/null +++ b/bytebuffer/long.d.ts @@ -0,0 +1,349 @@ +// Type definitions for ByteBuffer.js 5.0.0 +// Project: https://github.com/dcodeIO/bytebuffer.js + +declare class Long +{ + /** + * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs. + */ + constructor( low: number, high?: number, unsigned?: number ); + + /** + * Maximum unsigned value. + */ + static MAX_UNSIGNED_VALUE: Long; + + /** + * Maximum signed value. + */ + static MAX_VALUE: Long; + + /** + * Minimum signed value. + */ + static MIN_VALUE: Long; + + /** + * Signed negative one. + */ + static NEG_ONE: Long; + + /** + * Signed one. + */ + static ONE: Long; + + /** + * Unsigned one. + */ + static UONE: Long; + + /** + * Unsigned zero. + */ + static UZERO: Long; + + /** + * Signed zero + */ + static ZERO: Long; + + /** + * The high 32 bits as a signed value. + */ + high: number; + + /** + * The low 32 bits as a signed value. + */ + low: number; + + /** + * Whether unsigned or not. + */ + unsigned: number; + + /** + * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits. + */ + static fromBits( lowBits:number, highBits:number, unsigned?:boolean ): Long; + + /** + * Returns a Long representing the given 32 bit integer value. + */ + static fromInt( value: number, unsigned?: boolean ): Long; + + /** + * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. + */ + static fromNumber( value: number, unsigned?: boolean ): Long; + + /** + * Returns a Long representation of the given string, written using the specified radix. + */ + static fromString( str: string, unsigned?: boolean | number, radix?: number ): Long; + + /** + * Tests if the specified object is a Long. + */ + static isLong( obj: any ): boolean; + + /** + * Converts the specified value to a Long. + */ + static fromValue( val: Long | number | string | {low: number, high: number, unsigned: boolean} ): Long; + + /** + * Returns the sum of this and the specified Long. + */ + add( addend: number | Long | string ): Long; + + /** + * Returns the bitwise AND of this Long and the specified. + */ + and( other: Long | number | string ): Long; + + /** + * Compares this Long's value with the specified's. + */ + compare( other: Long | number | string ): number; + + /** + * Compares this Long's value with the specified's. + */ + comp( other: Long | number | string ): number; + + /** + * Returns this Long divided by the specified. + */ + divide( divisor: Long | number | string ): Long; + + /** + * Returns this Long divided by the specified. + */ + div( divisor: Long | number | string ): Long; + + /** + * Tests if this Long's value equals the specified's. + */ + equals( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value equals the specified's. + */ + eq( other: Long | number | string ): boolean; + + /** + * Gets the high 32 bits as a signed integer. + */ + getHighBits(): number; + + /** + * Gets the high 32 bits as an unsigned integer. + */ + getHighBitsUnsigned(): number; + + /** + * Gets the low 32 bits as a signed integer. + */ + getLowBits(): number; + + /** + * Gets the low 32 bits as an unsigned integer. + */ + getLowBitsUnsigned(): number; + + /** + * Gets the number of bits needed to represent the absolute value of this Long. + */ + getNumBitsAbs(): number; + + /** + * Tests if this Long's value is greater than the specified's. + */ + greaterThan( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is greater than the specified's. + */ + gt( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is greater than or equal the specified's. + */ + greaterThanOrEqual( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is greater than or equal the specified's. + */ + gte( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is even. + */ + isEven(): boolean; + + /** + * Tests if this Long's value is negative. + */ + isNegative(): boolean; + + /** + * Tests if this Long's value is odd. + */ + isOdd(): boolean; + + /** + * Tests if this Long's value is positive. + */ + isPositive(): boolean; + + /** + * Tests if this Long's value equals zero. + */ + isZero(): boolean; + + /** + * Tests if this Long's value is less than the specified's. + */ + lessThan( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is less than the specified's. + */ + lt( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is less than or equal the specified's. + */ + lessThanOrEqual( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is less than or equal the specified's. + */ + lte( other: Long | number | string ): boolean; + + /** + * Returns this Long modulo the specified. + */ + modulo( other: Long | number | string ): Long; + + /** + * Returns this Long modulo the specified. + */ + mod( other: Long | number | string ): Long; + + /** + * Returns the product of this and the specified Long. + */ + multiply( multiplier: Long | number | string ): Long; + + /** + * Returns the product of this and the specified Long. + */ + mul( multiplier: Long | number | string ): Long; + + /** + * Negates this Long's value. + */ + negate(): Long; + + /** + * Negates this Long's value. + */ + neg(): Long; + + /** + * Returns the bitwise NOT of this Long. + */ + not(): Long; + + /** + * Tests if this Long's value differs from the specified's. + */ + notEquals( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value differs from the specified's. + */ + neq( other: Long | number | string ): boolean; + + /** + * Returns the bitwise OR of this Long and the specified. + */ + or( other: Long | number | string ): Long; + + /** + * Returns this Long with bits shifted to the left by the given amount. + */ + shiftLeft( numBits: number | Long ): Long; + + /** + * Returns this Long with bits shifted to the left by the given amount. + */ + shl( numBits: number | Long ): Long; + + /** + * Returns this Long with bits arithmetically shifted to the right by the given amount. + */ + shiftRight( numBits: number | Long ): Long; + + /** + * Returns this Long with bits arithmetically shifted to the right by the given amount. + */ + shr( numBits: number | Long ): Long; + + /** + * Returns this Long with bits logically shifted to the right by the given amount. + */ + shiftRightUnsigned( numBits: number | Long ): Long; + + /** + * Returns this Long with bits logically shifted to the right by the given amount. + */ + shru( numBits: number | Long ): Long; + + /** + * Returns the difference of this and the specified Long. + */ + subtract( subtrahend: number | Long ): Long; + + /** + * Returns the difference of this and the specified Long. + */ + sub( subtrahend: number | Long ): Long; + + /** + * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. + */ + toInt(): number; + + /** + * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). + */ + toNumber(): number; + + /** + * Converts this Long to signed. + */ + toSigned(): Long; + + /** + * Converts the Long to a string written in the specified radix. + */ + toString( radix?: number ): string; + + /** + * Converts this Long to unsigned. + */ + toUnsigned(): Long; + + /** + * Returns the bitwise XOR of this Long and the given one. + */ + xor( other: Long | number | string ): Long; +} + +declare module 'long' { + export = Long; +} From d6ff5f59462d27165cde268db5e400e18b02b1ce Mon Sep 17 00:00:00 2001 From: dencap Date: Thu, 12 Nov 2015 15:37:37 +0100 Subject: [PATCH 007/107] Fixed comments in header --- bytebuffer/bytebuffer.d.ts | 3 +++ bytebuffer/long.d.ts | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bytebuffer/bytebuffer.d.ts b/bytebuffer/bytebuffer.d.ts index 6123ed50bd..71782bcb10 100644 --- a/bytebuffer/bytebuffer.d.ts +++ b/bytebuffer/bytebuffer.d.ts @@ -1,5 +1,8 @@ // Type definitions for ByteBuffer.js 5.0.0 // Project: https://github.com/dcodeIO/bytebuffer.js +// Definitions by: SINTEF-9012 +// Definitions by: Denis Cappellin +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/bytebuffer/long.d.ts b/bytebuffer/long.d.ts index f5825ffe71..1d2e9f3882 100644 --- a/bytebuffer/long.d.ts +++ b/bytebuffer/long.d.ts @@ -1,5 +1,7 @@ -// Type definitions for ByteBuffer.js 5.0.0 -// Project: https://github.com/dcodeIO/bytebuffer.js +// Type definitions for long.js 3.0.2 +// Project: https://github.com/dcodeIO/long.js +// Definitions by: Denis Cappellin +// Definitions: https://github.com/borisyankov/DefinitelyTyped declare class Long { From b9536c14d6030b3b99261b35fc3602e54dd838e6 Mon Sep 17 00:00:00 2001 From: dencap Date: Thu, 12 Nov 2015 17:02:21 +0100 Subject: [PATCH 008/107] Fixed problems suggested by Travis --- bytebuffer/bytebuffer-tests.ts | 8 ++++++++ bytebuffer/bytebuffer.d.ts | 12 ++++++------ bytebuffer/long-tests.ts | 6 ++++++ 3 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 bytebuffer/bytebuffer-tests.ts create mode 100644 bytebuffer/long-tests.ts diff --git a/bytebuffer/bytebuffer-tests.ts b/bytebuffer/bytebuffer-tests.ts new file mode 100644 index 0000000000..34db7368d5 --- /dev/null +++ b/bytebuffer/bytebuffer-tests.ts @@ -0,0 +1,8 @@ +/// + +import ByteBuffer = require("bytebuffer"); + +var bb = new ByteBuffer() + .writeIString("Hello world!") + .flip(); +console.log(bb.readIString()+" from bytebuffer.js"); \ No newline at end of file diff --git a/bytebuffer/bytebuffer.d.ts b/bytebuffer/bytebuffer.d.ts index 71782bcb10..bf1251e5f6 100644 --- a/bytebuffer/bytebuffer.d.ts +++ b/bytebuffer/bytebuffer.d.ts @@ -1,10 +1,10 @@ -// Type definitions for ByteBuffer.js 5.0.0 +// Type definitions for bytebuffer.js 5.0.0 // Project: https://github.com/dcodeIO/bytebuffer.js -// Definitions by: SINTEF-9012 // Definitions by: Denis Cappellin // Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions by: SINTEF-9012 -/// +/// declare class ByteBuffer { @@ -26,7 +26,7 @@ declare class ByteBuffer /** * Default no assertions flag of false. */ - static DEFAULT_NOASSERT + static DEFAULT_NOASSERT: boolean; /** * Little endian constant that can be used instead of its boolean value. Evaluates to true. @@ -51,7 +51,7 @@ declare class ByteBuffer /** * Metrics representing number of UTF8 characters.Evaluates to 1. */ - static METRICS_CHARS + static METRICS_CHARS: number; /** * ByteBuffer version. @@ -286,7 +286,7 @@ declare class ByteBuffer /** * Prints debug information about this ByteBuffer's contents. */ - printDebug( out?: ( string ) => void ): void; + printDebug( out?: ( text: string ) => void ): void; /** * Reads an 8bit signed integer. This is an alias of ByteBuffer#readInt8. diff --git a/bytebuffer/long-tests.ts b/bytebuffer/long-tests.ts new file mode 100644 index 0000000000..35dd6d7844 --- /dev/null +++ b/bytebuffer/long-tests.ts @@ -0,0 +1,6 @@ +/// + +import Long = require("long"); + +var longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF); +console.log(longVal.toString()); \ No newline at end of file From f2ae460e1751bb6668d291d4eb9255f047dd0ac5 Mon Sep 17 00:00:00 2001 From: Tadeusz Hucal Date: Fri, 13 Nov 2015 19:24:04 +0100 Subject: [PATCH 009/107] Update module name from ng to angular --- restangular/restangular-tests.ts | 2 +- restangular/restangular.d.ts | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/restangular/restangular-tests.ts b/restangular/restangular-tests.ts index 9b5a9c30b9..dba7099dad 100644 --- a/restangular/restangular-tests.ts +++ b/restangular/restangular-tests.ts @@ -50,7 +50,7 @@ myApp.config((RestangularProvider: restangular.IProvider) => { }); -interface MyAppScope extends ng.IScope { +interface MyAppScope extends angular.IScope { accounts: string[]; allAccounts: any[]; account: any; diff --git a/restangular/restangular.d.ts b/restangular/restangular.d.ts index b407cefd4d..db17e51cf8 100644 --- a/restangular/restangular.d.ts +++ b/restangular/restangular.d.ts @@ -16,13 +16,13 @@ declare module 'restangular' { declare module restangular { - interface IPromise extends ng.IPromise { + interface IPromise extends angular.IPromise { call(methodName: string, params?: any): IPromise; get(fieldName: string): IPromise; $object: T; } - interface ICollectionPromise extends ng.IPromise { + interface ICollectionPromise extends angular.IPromise { push(object: any): ICollectionPromise; call(methodName: string, params?: any): ICollectionPromise; get(fieldName: string): ICollectionPromise; @@ -49,14 +49,14 @@ declare module restangular { addElementTransformer(route: string, isCollection: boolean, transformer: Function): void; setTransformOnlyServerElements(active: boolean): void; setOnElemRestangularized(callback: (elem: any, isCollection: boolean, what: string, restangular: IService) => any): void; - setResponseInterceptor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: ng.IDeferred) => any): void; - setResponseExtractor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: ng.IDeferred) => any): void; - addResponseInterceptor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: ng.IDeferred) => any): void; + setResponseInterceptor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: angular.IDeferred) => any): void; + setResponseExtractor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: angular.IDeferred) => any): void; + addResponseInterceptor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: angular.IDeferred) => any): void; setRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string) => any): void; addRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string) => any): void; - setFullRequestInterceptor(fullRequestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: ng.IRequestShortcutConfig) => {element: any; headers: any; params: any}): void; - addFullRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: ng.IRequestShortcutConfig) => {headers: any; params: any; element: any; httpConfig: ng.IRequestShortcutConfig}): void; - setErrorInterceptor(errorInterceptor: (response: IResponse, deferred: ng.IDeferred) => any): void; + setFullRequestInterceptor(fullRequestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: angular.IRequestShortcutConfig) => {element: any; headers: any; params: any}): void; + addFullRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: angular.IRequestShortcutConfig) => {headers: any; params: any; element: any; httpConfig: angular.IRequestShortcutConfig}): void; + setErrorInterceptor(errorInterceptor: (response: IResponse, deferred: angular.IDeferred) => any): void; setRestangularFields(fields: {[fieldName: string]: string}): void; setMethodOverriders(overriders: string[]): void; setJsonp(jsonp: boolean): void; @@ -113,7 +113,7 @@ declare module restangular { clone(): IElement; plain(): any; plain(): T; - withHttpConfig(httpConfig: ng.IRequestShortcutConfig): IElement; + withHttpConfig(httpConfig: angular.IRequestShortcutConfig): IElement; save(queryParams?: any, headers?: any): IPromise; getRestangularUrl(): string; } @@ -128,7 +128,7 @@ declare module restangular { options(queryParams?: any, headers?: any): IPromise; patch(queryParams?: any, headers?: any): IPromise; putElement(idx: any, params: any, headers: any): IPromise; - withHttpConfig(httpConfig: ng.IRequestShortcutConfig): ICollection; + withHttpConfig(httpConfig: angular.IRequestShortcutConfig): ICollection; clone(): ICollection; plain(): any; plain(): T[]; From 6fa38f480230cba63f82c6d2d2f634846ae95f55 Mon Sep 17 00:00:00 2001 From: Ali Taheri Date: Sat, 7 Nov 2015 12:00:23 +0330 Subject: [PATCH 010/107] [material-ui] added missing style prop and isRtl on theme --- material-ui/material-ui.d.ts | 49 ++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index c31925d6f7..f90e6f5d9e 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -158,6 +158,7 @@ declare namespace __MaterialUI { interface CardActionsProps extends React.Props { expandable?: boolean; showExpandableButton?: boolean; + style?: React.CSSProperties; } export class CardActions extends React.Component { } @@ -165,6 +166,7 @@ declare namespace __MaterialUI { interface CardExpandableProps extends React.Props { onExpanding?: (isExpanded: boolean) => void; expanded?: boolean; + style?: React.CSSProperties; } export class CardExpandable extends React.Component { } @@ -288,6 +290,7 @@ declare namespace __MaterialUI { size?: number; color?: string; innerStyle?: React.CSSProperties; + style?: React.CSSProperties; } export class CircularProgress extends React.Component { @@ -351,6 +354,7 @@ declare namespace __MaterialUI { actionFocus?: string; autoDetectWindowHeight?: boolean; autoScrollBodyContent?: boolean; + style?: React.CSSProperties; bodyStyle?: React.CSSProperties; contentClassName?: string; contentInnerStyle?: React.CSSProperties; @@ -502,6 +506,7 @@ declare namespace __MaterialUI { menuItemClassName?: string; menuItemClassNameSubheader?: string; menuItemClassNameLink?: string; + style?: React.CSSProperties; } export class LeftNav extends React.Component { } @@ -521,6 +526,7 @@ declare namespace __MaterialUI { subheader?: string; subheaderStyle?: React.CSSProperties; zDepth?: number; + style?: React.CSSProperties; } export class List extends React.Component { } @@ -552,6 +558,7 @@ declare namespace __MaterialUI { primaryText?: React.ReactNode; secondaryText?: React.ReactNode; secondaryTextLines?: number; + style?: React.CSSProperties; } export class ListItem extends React.Component { } @@ -577,6 +584,7 @@ declare namespace __MaterialUI { toggle?: boolean; onTouchTap?: TouchTapEventHandler; isDisabled?: boolean; + style?: React.CSSProperties; // for MenuItems.Types.NESTED items?: MenuItemRequest[]; @@ -593,6 +601,7 @@ declare namespace __MaterialUI { active?: boolean; onItemTap?: ItemTapEventHandler; menuItemStyle?: React.CSSProperties; + style?: React.CSSProperties; } export class Menu extends React.Component { } @@ -612,6 +621,7 @@ declare namespace __MaterialUI { onToggle?: (e: React.MouseEvent, key: number, toggled: boolean) => void; selected?: boolean; active?: boolean; + style?: React.CSSProperties; } export class MenuItem extends React.Component { static Types: { LINK: string, SUBHEADER: string, NESTED: string, } @@ -705,6 +715,7 @@ declare namespace __MaterialUI { size?: number; status?: string; top: number; + style?: React.CSSProperties; } export class RefreshIndicator extends React.Component { } @@ -713,12 +724,14 @@ declare namespace __MaterialUI { interface CircleRippleProps extends React.Props { color?: string; opacity?: number; + style?: React.CSSProperties; } export class CircleRipple extends React.Component { } interface FocusRippleProps extends React.Props { color?: string; + style?: React.CSSProperties; innerStyle?: React.CSSProperties; opacity?: number; show?: boolean; @@ -730,6 +743,7 @@ declare namespace __MaterialUI { centerRipple?: boolean; color?: string; opacity?: number; + style?: React.CSSProperties; } export class TouchRipple extends React.Component { } @@ -782,6 +796,7 @@ declare namespace __MaterialUI { required?: boolean; step?: number; value?: number; + style?: React.CSSProperties; } export class Slider extends React.Component { } @@ -790,6 +805,7 @@ declare namespace __MaterialUI { color?: string; hoverColor?: string; viewBox?: string; + style?: React.CSSProperties; } export class SvgIcon extends React.Component { } @@ -1037,6 +1053,7 @@ declare namespace __MaterialUI { backgroundColor?: string; borderColor?: string; }; + isRtl: boolean; } interface RawTheme { @@ -1064,7 +1081,7 @@ declare namespace __MaterialUI { export var Transitions: Transitions; interface Typography { - textFullBlack:string; + textFullBlack: string; textDarkBlack: string; textLightBlack: string; textMinBlack: string; @@ -1093,6 +1110,7 @@ declare namespace __MaterialUI { onShow?: () => void; onDismiss?: () => void; openOnMount?: boolean; + style?: React.CSSProperties; } export class Snackbar extends React.Component { } @@ -1103,6 +1121,7 @@ declare namespace __MaterialUI { value?: string; selected?: boolean; width?: string; + style?: React.CSSProperties; // Called by Tabs component onActive?: (tab: Tab) => void; @@ -1139,8 +1158,9 @@ declare namespace __MaterialUI { onCellHoverExit?: (row: number, column: number) => void; onRowHover?: (row: number) => void; onRowHoverExit?: (row: number) => void; - onRowSelection?: (selectedRows: number[])=> void; + onRowSelection?: (selectedRows: number[]) => void; selectable?: boolean; + style?: React.CSSProperties; } export class Table extends React.Component { } @@ -1155,17 +1175,19 @@ declare namespace __MaterialUI { onCellHoverExit?: (row: number, column: number) => void; onRowHover?: (row: number) => void; onRowHoverExit?: (row: number) => void; - onRowSelection?: (selectedRows: number[])=> void; + onRowSelection?: (selectedRows: number[]) => void; preScanRows?: boolean; selectable?: boolean; showRowHover?: boolean; stripedRows?: boolean; + style?: React.CSSProperties; } export class TableBody extends React.Component { } interface TableFooterProps extends React.Props { adjustForCheckbox?: boolean; + style?: React.CSSProperties; } export class TableFooter extends React.Component { } @@ -1176,15 +1198,17 @@ declare namespace __MaterialUI { enableSelectAll?: boolean; onSelectAll?: (event: React.MouseEvent) => void; selectAllSelected?: boolean; + style?: React.CSSProperties; } export class TableHeader extends React.Component { } interface TableHeaderColumnProps extends React.Props { columnNumber?: number; - onClick?: (e: React.MouseEvent, column: number) => void; + onClick?: (e: React.MouseEvent, column: number) => void; tooltip?: string; tooltipStyle?: React.CSSProperties; + style?: React.CSSProperties; } export class TableHeaderColumn extends React.Component { } @@ -1202,6 +1226,7 @@ declare namespace __MaterialUI { selectable?: boolean; selected?: boolean; striped?: boolean; + style?: React.CSSProperties; } export class TableRow extends React.Component { } @@ -1211,6 +1236,7 @@ declare namespace __MaterialUI { hoverable?: boolean; onHover?: (e: React.MouseEvent, column: number) => void; onHoverExit?: (e: React.MouseEvent, column: number) => void; + style?: React.CSSProperties; } export class TableRowColumn extends React.Component { } @@ -1289,23 +1315,27 @@ declare namespace __MaterialUI { namespace Toolbar { interface ToolbarProps extends React.Props { + style?: React.CSSProperties; } export class Toolbar extends React.Component { } interface ToolbarGroupProps extends React.Props { float?: string; + style?: React.CSSProperties; } export class ToolbarGroup extends React.Component { } interface ToolbarSeparatorProps extends React.Props { + style?: React.CSSProperties; } export class ToolbarSeparator extends React.Component { } interface ToolbarTitleProps extends React.HTMLAttributes, React.Props { - text?: string; + text?: string; + style?: React.CSSProperties; } export class ToolbarTitle extends React.Component { } @@ -1327,9 +1357,9 @@ declare namespace __MaterialUI { color: string; } interface ColorManipulator { - fade(color: string, amount: string|number): string; - lighten(color: string, amount: string|number): string; - darken(color: string, amount: string|number): string; + fade(color: string, amount: string | number): string; + lighten(color: string, amount: string | number): string; + darken(color: string, amount: string | number): string; contrastRatio(background: string, foreground: string): number; contrastRatioLevel(background: string, foreground: string): ContrastLevel; } @@ -1421,6 +1451,7 @@ declare namespace __MaterialUI { value?: string | Array; width?: string | number; touchTapCloseDelay?: number; + style?: React.CSSProperties; onKeyboardFocus?: React.FocusEventHandler; onItemTouchTap?: (e: TouchTapEvent, item: React.ReactElement) => void; @@ -1440,6 +1471,7 @@ declare namespace __MaterialUI { value?: string | Array; width?: string | number; zDepth?: number; + style?: React.CSSProperties; } export class Menu extends React.Component{ } @@ -1455,6 +1487,7 @@ declare namespace __MaterialUI { rightIcon?: React.ReactElement; secondaryText?: React.ReactNode; value?: string; + style?: React.CSSProperties; onEscKeyDown?: React.KeyboardEventHandler; onItemTouchTap?: (e: TouchTapEvent, item: React.ReactElement) => void; From ec2915345b5e5bd7817c09b6094810d3f26ffc6c Mon Sep 17 00:00:00 2001 From: dencap Date: Mon, 16 Nov 2015 15:15:58 +0100 Subject: [PATCH 011/107] Removed long.js files from folder bytebuffer, fixed some function signatures and updated the version of long available in folder long --- bytebuffer/bytebuffer.d.ts | 2 +- long/long-tests.ts | 2 +- long/long.d.ts | 405 +++++++++++++++++++++++++++++++------ 3 files changed, 343 insertions(+), 66 deletions(-) diff --git a/bytebuffer/bytebuffer.d.ts b/bytebuffer/bytebuffer.d.ts index bf1251e5f6..0bfaed7c16 100644 --- a/bytebuffer/bytebuffer.d.ts +++ b/bytebuffer/bytebuffer.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped // Definitions by: SINTEF-9012 -/// +/// declare class ByteBuffer { diff --git a/long/long-tests.ts b/long/long-tests.ts index f70835f662..928cc94530 100644 --- a/long/long-tests.ts +++ b/long/long-tests.ts @@ -2,7 +2,7 @@ import Long = require("long"); -var val: dcodeIO.Long; +var val: Long; var n: number = 42; var b: boolean = true; var s: string = "1337"; diff --git a/long/long.d.ts b/long/long.d.ts index 32d773b9d1..f059ff5656 100644 --- a/long/long.d.ts +++ b/long/long.d.ts @@ -1,75 +1,352 @@ -// Type definitions for Long.js v2.2.5 -// Project: https://github.com/dcodeIO/Long.js -// Definitions by: Peter Kooijmans +// Type definitions for long.js 3.0.2 +// Project: https://github.com/dcodeIO/long.js +// Definitions by: Denis Cappellin // Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions by: Peter Kooijmans -declare module dcodeIO { - interface LongStatic { - new (low: number, high?: number, unsigned?: boolean): Long; +declare class Long +{ + /** + * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs. + */ + constructor( low: number, high?: number, unsigned?: boolean ); - MAX_UNSIGNED_VALUE: Long; - MAX_VALUE: Long; - MIN_VALUE: Long; - NEG_ONE: Long; - ONE: Long; - UONE: Long; - UZERO: Long; - ZERO: Long; + /** + * Maximum unsigned value. + */ + static MAX_UNSIGNED_VALUE: Long; - fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long; - fromInt(value: number, unsigned?: boolean): Long; - fromNumber(value: number, unsigned?: boolean): Long; - fromString(str: string, unsigned?: boolean | number, radix?: number): Long; - fromValue(val: Long | number | string): Long; - isLong(obj: any): boolean; - } + /** + * Maximum signed value. + */ + static MAX_VALUE: Long; - interface Long { - high: number; - low: number; - unsigned: boolean; + /** + * Minimum signed value. + */ + static MIN_VALUE: Long; - add(other: Long | number | string): Long; - and(other: Long | number | string): Long; - compare(other: Long | number | string): number; - div(divisor: Long | number | string): Long; - equals(other: Long | number | string): boolean; - getHighBits(): number; - getHighBitsUnsigned(): number; - getLowBits(): number; - getLowBitsUnsigned(): number; - getNumBitsAbs(): number; - greaterThan(other: Long | number | string): boolean; - greaterThanOrEqual(other: Long | number | string): boolean; - isEven(): boolean; - isNegative(): boolean; - isOdd(): boolean; - isPositive(): boolean; - isZero(): boolean; - lessThan(other: Long | number | string): boolean; - lessThanOrEqual(other: Long | number | string): boolean; - modulo(divisor: Long | number | string): Long; - multiply(multiplier: Long | number | string): Long; - negate(): Long; - not(): Long; - notEquals(other: Long | number | string): boolean; - or(other: Long | number | string): Long; - shiftLeft(numBits: number | Long): Long; - shiftRight(numBits: number | Long): Long; - shiftRightUnsigned(numBits: number | Long): Long; - subtract(other: Long | number | string): Long; - toInt(): number; - toNumber(): number; - toSigned(): Long; - toString(radix?: number): string; - toUnsigned(): Long; - xor(other: Long | number | string): Long; - } + /** + * Signed negative one. + */ + static NEG_ONE: Long; - export var Long: LongStatic; + /** + * Signed one. + */ + static ONE: Long; + + /** + * Unsigned one. + */ + static UONE: Long; + + /** + * Unsigned zero. + */ + static UZERO: Long; + + /** + * Signed zero + */ + static ZERO: Long; + + /** + * The high 32 bits as a signed value. + */ + high: number; + + /** + * The low 32 bits as a signed value. + */ + low: number; + + /** + * Whether unsigned or not. + */ + unsigned: boolean; + + /** + * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits. + */ + static fromBits( lowBits:number, highBits:number, unsigned?:boolean ): Long; + + /** + * Returns a Long representing the given 32 bit integer value. + */ + static fromInt( value: number, unsigned?: boolean ): Long; + + /** + * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. + */ + static fromNumber( value: number, unsigned?: boolean ): Long; + + /** + * Returns a Long representation of the given string, written using the specified radix. + */ + static fromString( str: string, unsigned?: boolean | number, radix?: number ): Long; + + /** + * Tests if the specified object is a Long. + */ + static isLong( obj: any ): boolean; + + /** + * Converts the specified value to a Long. + */ + static fromValue( val: Long | number | string | {low: number, high: number, unsigned: boolean} ): Long; + + /** + * Returns the sum of this and the specified Long. + */ + add( addend: number | Long | string ): Long; + + /** + * Returns the bitwise AND of this Long and the specified. + */ + and( other: Long | number | string ): Long; + + /** + * Compares this Long's value with the specified's. + */ + compare( other: Long | number | string ): number; + + /** + * Compares this Long's value with the specified's. + */ + comp( other: Long | number | string ): number; + + /** + * Returns this Long divided by the specified. + */ + divide( divisor: Long | number | string ): Long; + + /** + * Returns this Long divided by the specified. + */ + div( divisor: Long | number | string ): Long; + + /** + * Tests if this Long's value equals the specified's. + */ + equals( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value equals the specified's. + */ + eq( other: Long | number | string ): boolean; + + /** + * Gets the high 32 bits as a signed integer. + */ + getHighBits(): number; + + /** + * Gets the high 32 bits as an unsigned integer. + */ + getHighBitsUnsigned(): number; + + /** + * Gets the low 32 bits as a signed integer. + */ + getLowBits(): number; + + /** + * Gets the low 32 bits as an unsigned integer. + */ + getLowBitsUnsigned(): number; + + /** + * Gets the number of bits needed to represent the absolute value of this Long. + */ + getNumBitsAbs(): number; + + /** + * Tests if this Long's value is greater than the specified's. + */ + greaterThan( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is greater than the specified's. + */ + gt( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is greater than or equal the specified's. + */ + greaterThanOrEqual( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is greater than or equal the specified's. + */ + gte( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is even. + */ + isEven(): boolean; + + /** + * Tests if this Long's value is negative. + */ + isNegative(): boolean; + + /** + * Tests if this Long's value is odd. + */ + isOdd(): boolean; + + /** + * Tests if this Long's value is positive. + */ + isPositive(): boolean; + + /** + * Tests if this Long's value equals zero. + */ + isZero(): boolean; + + /** + * Tests if this Long's value is less than the specified's. + */ + lessThan( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is less than the specified's. + */ + lt( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is less than or equal the specified's. + */ + lessThanOrEqual( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value is less than or equal the specified's. + */ + lte( other: Long | number | string ): boolean; + + /** + * Returns this Long modulo the specified. + */ + modulo( other: Long | number | string ): Long; + + /** + * Returns this Long modulo the specified. + */ + mod( other: Long | number | string ): Long; + + /** + * Returns the product of this and the specified Long. + */ + multiply( multiplier: Long | number | string ): Long; + + /** + * Returns the product of this and the specified Long. + */ + mul( multiplier: Long | number | string ): Long; + + /** + * Negates this Long's value. + */ + negate(): Long; + + /** + * Negates this Long's value. + */ + neg(): Long; + + /** + * Returns the bitwise NOT of this Long. + */ + not(): Long; + + /** + * Tests if this Long's value differs from the specified's. + */ + notEquals( other: Long | number | string ): boolean; + + /** + * Tests if this Long's value differs from the specified's. + */ + neq( other: Long | number | string ): boolean; + + /** + * Returns the bitwise OR of this Long and the specified. + */ + or( other: Long | number | string ): Long; + + /** + * Returns this Long with bits shifted to the left by the given amount. + */ + shiftLeft( numBits: number | Long ): Long; + + /** + * Returns this Long with bits shifted to the left by the given amount. + */ + shl( numBits: number | Long ): Long; + + /** + * Returns this Long with bits arithmetically shifted to the right by the given amount. + */ + shiftRight( numBits: number | Long ): Long; + + /** + * Returns this Long with bits arithmetically shifted to the right by the given amount. + */ + shr( numBits: number | Long ): Long; + + /** + * Returns this Long with bits logically shifted to the right by the given amount. + */ + shiftRightUnsigned( numBits: number | Long ): Long; + + /** + * Returns this Long with bits logically shifted to the right by the given amount. + */ + shru( numBits: number | Long ): Long; + + /** + * Returns the difference of this and the specified Long. + */ + subtract( subtrahend: number | Long | string ): Long; + + /** + * Returns the difference of this and the specified Long. + */ + sub( subtrahend: number | Long |string ): Long; + + /** + * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. + */ + toInt(): number; + + /** + * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). + */ + toNumber(): number; + + /** + * Converts this Long to signed. + */ + toSigned(): Long; + + /** + * Converts the Long to a string written in the specified radix. + */ + toString( radix?: number ): string; + + /** + * Converts this Long to unsigned. + */ + toUnsigned(): Long; + + /** + * Returns the bitwise XOR of this Long and the given one. + */ + xor( other: Long | number | string ): Long; } -declare module "long" { - var Long: dcodeIO.LongStatic; +declare module 'long' { export = Long; } \ No newline at end of file From bf9c2fe2143a2b0a874b0589dee819773925b3a5 Mon Sep 17 00:00:00 2001 From: dencap Date: Mon, 16 Nov 2015 16:44:35 +0100 Subject: [PATCH 012/107] Removed long.js filed from bytebuffer folder and restored original author name in long.js --- bytebuffer/long-tests.ts | 6 - bytebuffer/long.d.ts | 351 --------------------------------------- long/long.d.ts | 4 +- 3 files changed, 2 insertions(+), 359 deletions(-) delete mode 100644 bytebuffer/long-tests.ts delete mode 100644 bytebuffer/long.d.ts diff --git a/bytebuffer/long-tests.ts b/bytebuffer/long-tests.ts deleted file mode 100644 index 35dd6d7844..0000000000 --- a/bytebuffer/long-tests.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// - -import Long = require("long"); - -var longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF); -console.log(longVal.toString()); \ No newline at end of file diff --git a/bytebuffer/long.d.ts b/bytebuffer/long.d.ts deleted file mode 100644 index 1d2e9f3882..0000000000 --- a/bytebuffer/long.d.ts +++ /dev/null @@ -1,351 +0,0 @@ -// Type definitions for long.js 3.0.2 -// Project: https://github.com/dcodeIO/long.js -// Definitions by: Denis Cappellin -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare class Long -{ - /** - * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs. - */ - constructor( low: number, high?: number, unsigned?: number ); - - /** - * Maximum unsigned value. - */ - static MAX_UNSIGNED_VALUE: Long; - - /** - * Maximum signed value. - */ - static MAX_VALUE: Long; - - /** - * Minimum signed value. - */ - static MIN_VALUE: Long; - - /** - * Signed negative one. - */ - static NEG_ONE: Long; - - /** - * Signed one. - */ - static ONE: Long; - - /** - * Unsigned one. - */ - static UONE: Long; - - /** - * Unsigned zero. - */ - static UZERO: Long; - - /** - * Signed zero - */ - static ZERO: Long; - - /** - * The high 32 bits as a signed value. - */ - high: number; - - /** - * The low 32 bits as a signed value. - */ - low: number; - - /** - * Whether unsigned or not. - */ - unsigned: number; - - /** - * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits. - */ - static fromBits( lowBits:number, highBits:number, unsigned?:boolean ): Long; - - /** - * Returns a Long representing the given 32 bit integer value. - */ - static fromInt( value: number, unsigned?: boolean ): Long; - - /** - * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. - */ - static fromNumber( value: number, unsigned?: boolean ): Long; - - /** - * Returns a Long representation of the given string, written using the specified radix. - */ - static fromString( str: string, unsigned?: boolean | number, radix?: number ): Long; - - /** - * Tests if the specified object is a Long. - */ - static isLong( obj: any ): boolean; - - /** - * Converts the specified value to a Long. - */ - static fromValue( val: Long | number | string | {low: number, high: number, unsigned: boolean} ): Long; - - /** - * Returns the sum of this and the specified Long. - */ - add( addend: number | Long | string ): Long; - - /** - * Returns the bitwise AND of this Long and the specified. - */ - and( other: Long | number | string ): Long; - - /** - * Compares this Long's value with the specified's. - */ - compare( other: Long | number | string ): number; - - /** - * Compares this Long's value with the specified's. - */ - comp( other: Long | number | string ): number; - - /** - * Returns this Long divided by the specified. - */ - divide( divisor: Long | number | string ): Long; - - /** - * Returns this Long divided by the specified. - */ - div( divisor: Long | number | string ): Long; - - /** - * Tests if this Long's value equals the specified's. - */ - equals( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value equals the specified's. - */ - eq( other: Long | number | string ): boolean; - - /** - * Gets the high 32 bits as a signed integer. - */ - getHighBits(): number; - - /** - * Gets the high 32 bits as an unsigned integer. - */ - getHighBitsUnsigned(): number; - - /** - * Gets the low 32 bits as a signed integer. - */ - getLowBits(): number; - - /** - * Gets the low 32 bits as an unsigned integer. - */ - getLowBitsUnsigned(): number; - - /** - * Gets the number of bits needed to represent the absolute value of this Long. - */ - getNumBitsAbs(): number; - - /** - * Tests if this Long's value is greater than the specified's. - */ - greaterThan( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is greater than the specified's. - */ - gt( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is greater than or equal the specified's. - */ - greaterThanOrEqual( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is greater than or equal the specified's. - */ - gte( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is even. - */ - isEven(): boolean; - - /** - * Tests if this Long's value is negative. - */ - isNegative(): boolean; - - /** - * Tests if this Long's value is odd. - */ - isOdd(): boolean; - - /** - * Tests if this Long's value is positive. - */ - isPositive(): boolean; - - /** - * Tests if this Long's value equals zero. - */ - isZero(): boolean; - - /** - * Tests if this Long's value is less than the specified's. - */ - lessThan( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is less than the specified's. - */ - lt( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is less than or equal the specified's. - */ - lessThanOrEqual( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value is less than or equal the specified's. - */ - lte( other: Long | number | string ): boolean; - - /** - * Returns this Long modulo the specified. - */ - modulo( other: Long | number | string ): Long; - - /** - * Returns this Long modulo the specified. - */ - mod( other: Long | number | string ): Long; - - /** - * Returns the product of this and the specified Long. - */ - multiply( multiplier: Long | number | string ): Long; - - /** - * Returns the product of this and the specified Long. - */ - mul( multiplier: Long | number | string ): Long; - - /** - * Negates this Long's value. - */ - negate(): Long; - - /** - * Negates this Long's value. - */ - neg(): Long; - - /** - * Returns the bitwise NOT of this Long. - */ - not(): Long; - - /** - * Tests if this Long's value differs from the specified's. - */ - notEquals( other: Long | number | string ): boolean; - - /** - * Tests if this Long's value differs from the specified's. - */ - neq( other: Long | number | string ): boolean; - - /** - * Returns the bitwise OR of this Long and the specified. - */ - or( other: Long | number | string ): Long; - - /** - * Returns this Long with bits shifted to the left by the given amount. - */ - shiftLeft( numBits: number | Long ): Long; - - /** - * Returns this Long with bits shifted to the left by the given amount. - */ - shl( numBits: number | Long ): Long; - - /** - * Returns this Long with bits arithmetically shifted to the right by the given amount. - */ - shiftRight( numBits: number | Long ): Long; - - /** - * Returns this Long with bits arithmetically shifted to the right by the given amount. - */ - shr( numBits: number | Long ): Long; - - /** - * Returns this Long with bits logically shifted to the right by the given amount. - */ - shiftRightUnsigned( numBits: number | Long ): Long; - - /** - * Returns this Long with bits logically shifted to the right by the given amount. - */ - shru( numBits: number | Long ): Long; - - /** - * Returns the difference of this and the specified Long. - */ - subtract( subtrahend: number | Long ): Long; - - /** - * Returns the difference of this and the specified Long. - */ - sub( subtrahend: number | Long ): Long; - - /** - * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. - */ - toInt(): number; - - /** - * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). - */ - toNumber(): number; - - /** - * Converts this Long to signed. - */ - toSigned(): Long; - - /** - * Converts the Long to a string written in the specified radix. - */ - toString( radix?: number ): string; - - /** - * Converts this Long to unsigned. - */ - toUnsigned(): Long; - - /** - * Returns the bitwise XOR of this Long and the given one. - */ - xor( other: Long | number | string ): Long; -} - -declare module 'long' { - export = Long; -} diff --git a/long/long.d.ts b/long/long.d.ts index f059ff5656..492dc3362b 100644 --- a/long/long.d.ts +++ b/long/long.d.ts @@ -1,8 +1,8 @@ // Type definitions for long.js 3.0.2 // Project: https://github.com/dcodeIO/long.js -// Definitions by: Denis Cappellin -// Definitions: https://github.com/borisyankov/DefinitelyTyped // Definitions by: Peter Kooijmans +// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions by: Denis Cappellin declare class Long { From 352d8a7f1923d66f939b312b39c6414f9d2761ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elis=C3=A9e?= Date: Wed, 18 Nov 2015 18:28:06 +0100 Subject: [PATCH 013/107] three: Add missing shadowMap WebGLRenderer member --- threejs/three.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/threejs/three.d.ts b/threejs/three.d.ts index b01c38c63a..fb890afe6a 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -4588,6 +4588,8 @@ declare module THREE { }; }; + shadowMap: WebGLShadowMapInstance; + /** * Return the WebGL context. */ From 161d514d1259011b6c194ef4c4b456d64f25a1f1 Mon Sep 17 00:00:00 2001 From: John Vilk Date: Thu, 19 Nov 2015 00:54:36 -0500 Subject: [PATCH 014/107] [browserify] Update definitions to match latest API. Add comments from documentation. I've also inferred extra information through examining the source code, as particular options are not well-documented. This also updates envify's typings to be more specific. --- browserify/browserify-tests.ts | 48 +++++++- browserify/browserify.d.ts | 197 ++++++++++++++++++++++++++++----- envify/envify.d.ts | 6 +- 3 files changed, 217 insertions(+), 34 deletions(-) diff --git a/browserify/browserify-tests.ts b/browserify/browserify-tests.ts index 5249015661..b4096a7f98 100644 --- a/browserify/browserify-tests.ts +++ b/browserify/browserify-tests.ts @@ -2,11 +2,51 @@ import browserify = require("browserify"); import fs = require("fs"); +import stream = require('stream'); -var b: BrowserifyObject = browserify(); +var bNoArg = browserify(); + +var b = browserify({ + baseDir: 'somewhere' +}); b.add('./browser/main.js'); -b.transform('deamdify'); -b.bundle().pipe(fs.createWriteStream('bundle.js')); +b.transform('deamdify') + .transform(function (file) { + return new stream.Transform(); + }).plugin((b, opts) => { return opts.l; }, {l: 3}) + .require('foo', { expose: 'bar' }) + .exclude('baz') + .ignore('bat') + .reset({ basedir: 'elsewhere' }); -var customBrowsify: Browserify = require("browserify"); +b.on('file', (file) => { + file += ""; +}); + +b.external(bNoArg); + +var b2 = new browserify(['/some/File', {file: '/some/file' }, fs.createReadStream('/somewhere')], { builtins: ['buffer']}) + .reset({ + builtins: { + 'buffer': './customBuffer' + } + }); + +var customBrowsify = require("browserify"); customBrowsify({entries: []}); + +var b = browserify('./browser/main.js', { + noParse: ['jquery'], + debug: true, + foo: 'bar' +}); +b.add('./browser/other.js'); +b.transform(function(file: string): NodeJS.ReadWriteStream { + return new stream.PassThrough(); +}); + +var record_pipeline = b.pipeline.get('record'); + +b.bundle().pipe(process.stdout); + + diff --git a/browserify/browserify.d.ts b/browserify/browserify.d.ts index c301df51eb..1ce6b653d3 100644 --- a/browserify/browserify.d.ts +++ b/browserify/browserify.d.ts @@ -1,41 +1,182 @@ -// Type definitions for Browserify +// Type definitions for Browserify v12.0.1 // Project: http://browserify.org/ -// Definitions by: Andrew Gaspar +// Definitions by: Andrew Gaspar , John Vilk // Definitions: https://github.com/borisyankov/DefinitelyTyped /// -interface BrowserifyObject extends NodeJS.EventEmitter { - add(file:string, opts?:any): BrowserifyObject; - require(file:string, opts?:{ - expose: string; - }): BrowserifyObject; - bundle(opts?:{ - insertGlobals?: boolean; - detectGlobals?: boolean; - debug?: boolean; - standalone?: string; - insertGlobalVars?: any; - }, cb?:(err:any, src:any) => void): NodeJS.ReadableStream; +declare module Browserify { + /** + * Options pertaining to an individual file. + */ + interface FileOptions { + // If true, this is considered an entry point to your app. + entry?: boolean; + // Expose this file under a custom dependency name. + // require('./vendor/angular/angular.js', {expose: 'angular'}) enables require('angular') + expose?: string; + // Basedir to use to resolve this file's path. + basedir?: string; + // The name/path to the file. + file?: string; + // Forward file to external() to be externalized. + external?: boolean; + // Disable transforms on file if set to false. + transform?: boolean; + // The ID to use for require() statements. + id?: string; + } - external(file:string, opts?:any): BrowserifyObject; - ignore(file:string, opts?:any): BrowserifyObject; - transform(tr:string, opts?:any): BrowserifyObject; - transform(tr:Function, opts?:any): BrowserifyObject; - plugin(plugin:string, opts?:any): BrowserifyObject; - plugin(plugin:Function, opts?:any): BrowserifyObject; -} -interface Browserify { - (): BrowserifyObject; - (files:string[]): BrowserifyObject; - (opts:{ - entries?: string[]; + // Browserify accepts a filename, an input stream for file inputs, or a FileOptions configuration + // for each file in a bundle. + type InputFile = string | NodeJS.ReadableStream | FileOptions; + + /** + * Options pertaining to a Browserify instance. + */ + interface Options { + // Custom properties can be defined on Options. + // These options are forwarded along to module-deps and browser-pack directly. + [propName: string]: any; + // String, file object, or array of those types (they may be mixed) specifying entry file(s). + entries?: InputFile | InputFile[]; + // an array which will skip all require() and global parsing for each file in the array. + // Use this for giant libs like jquery or threejs that don't have any requires or node-style globals but take forever to parse. noParse?: string[]; - }): BrowserifyObject; + // an array of optional extra extensions for the module lookup machinery to use when the extension has not been specified. + // By default Browserify considers only .js and .json files in such cases. + extensions?: string[]; + // the directory that Browserify starts bundling from for filenames that start with .. + basedir?: string; + // an array of directories that Browserify searches when looking for modules which are not referenced using relative path. + // Can be absolute or relative to basedir. Equivalent of setting NODE_PATH environmental variable when calling Browserify command. + paths?: string[]; + // sets the algorithm used to parse out the common paths. Use false to turn this off, otherwise it uses the commondir module. + commondir?: boolean; + // disables converting module ids into numerical indexes. This is useful for preserving the original paths that a bundle was generated with. + fullPaths?: boolean; + // sets the list of built-ins to use, which by default is set in lib/builtins.js in this distribution. + builtins?: string[] | {[builtinName: string]: string} | boolean; + // set if external modules should be bundled. Defaults to true. + bundleExternal?: boolean; + // When true, always insert process, global, __filename, and __dirname without analyzing the AST for faster builds but larger output bundles. Default false. + insertGlobals?: boolean; + // When true, scan all files for process, global, __filename, and __dirname, defining as necessary. + // With this option npm modules are more likely to work but bundling takes longer. Default true. + detectGlobals?: boolean; + // When true, add a source map inline to the end of the bundle. This makes debugging easier because you can see all the original files if you are in a modern enough browser. + debug?: boolean; + // When a non-empty string, a standalone module is created with that name and a umd wrapper. + // You can use namespaces in the standalone global export using a . in the string name as a separator, for example 'A.B.C'. + // The global export will be sanitized and camel cased. + standalone?: string; + // will be passed to insert-module-globals as the opts.vars parameter. + insertGlobalVars?: {[globalName: string]: (file: string, basedir: string) => any}; + // defaults to 'require' in expose mode but you can use another name. + externalRequireName?: string; + } + + interface BrowserifyConstructor { + (files: InputFile[], opts?: Options): BrowserifyObject; + (file: InputFile, opts?: Options): BrowserifyObject; + (opts: Options): BrowserifyObject; + (): BrowserifyObject + new(files: InputFile[], opts?: Options): BrowserifyObject; + new(file: InputFile, opts?: Options): BrowserifyObject; + new(opts: Options): BrowserifyObject; + new(): BrowserifyObject + } + + interface BrowserifyObject extends NodeJS.EventEmitter { + /** + * Add an entry file from file that will be executed when the bundle loads. + * If file is an array, each item in file will be added as an entry file. + */ + add(file: InputFile[], opts?: FileOptions): BrowserifyObject; + add(file: InputFile, opts?: FileOptions): BrowserifyObject; + /** + * Make file available from outside the bundle with require(file). + * The file param is anything that can be resolved by require.resolve(). + * file can also be a stream, but you should also use opts.basedir so that relative requires will be resolvable. + * If file is an array, each item in file will be required. In file array form, you can use a string or object for each item. Object items should have a file property and the rest of the parameters will be used for the opts. + * Use the expose property of opts to specify a custom dependency name. require('./vendor/angular/angular.js', {expose: 'angular'}) enables require('angular') + */ + require(file: InputFile, opts?: FileOptions): BrowserifyObject; + /** + * Bundle the files and their dependencies into a single javascript file. + * Return a readable stream with the javascript file contents or optionally specify a cb(err, buf) to get the buffered results. + */ + bundle(cb?: (err: any, src: Buffer) => any): NodeJS.ReadableStream; + /** + * Prevent file from being loaded into the current bundle, instead referencing from another bundle. + * If file is an array, each item in file will be externalized. + * If file is another bundle, that bundle's contents will be read and excluded from the current bundle as the bundle in file gets bundled. + */ + external(file: string[], opts?: { basedir?: string }): BrowserifyObject; + external(file: string, opts?: { basedir?: string }): BrowserifyObject; + external(file: BrowserifyObject): BrowserifyObject; + /** + * Prevent the module name or file at file from showing up in the output bundle. + * Instead you will get a file with module.exports = {}. + */ + ignore(file: string, opts?: { basedir?: string }): BrowserifyObject; + /** + * Prevent the module name or file at file from showing up in the output bundle. + * If your code tries to require() that file it will throw unless you've provided another mechanism for loading it. + */ + exclude(file: string, opts?: { basedir?: string }): BrowserifyObject; + /** + * Transform source code before parsing it for require() calls with the transform function or module name tr. + * If tr is a function, it will be called with tr(file) and it should return a through-stream that takes the raw file contents and produces the transformed source. + * If tr is a string, it should be a module name or file path of a transform module + */ + transform(tr: string, opts?: T): BrowserifyObject; + transform(tr: (file: string, opts: T) => NodeJS.ReadWriteStream, opts?: T): BrowserifyObject; + /** + * Register a plugin with opts. Plugins can be a string module name or a function the same as transforms. + * plugin(b, opts) is called with the Browserify instance b. + */ + plugin(plugin: string, opts?: T): BrowserifyObject; + plugin(plugin: (b: BrowserifyObject, opts: T) => any, opts?: T): BrowserifyObject; + /** + * Reset the pipeline back to a normal state. This function is called automatically when bundle() is called multiple times. + * This function triggers a 'reset' event. + */ + reset(opts?: Options): void; + + /** + * When a file is resolved for the bundle, the bundle emits a 'file' event with the full file path, the id string passed to require(), and the parent object used by browser-resolve. + * You could use the file event to implement a file watcher to regenerate bundles when files change. + */ + on(event: 'file', listener: (file: string, id: string, parent: any) => any): BrowserifyObject; + /** + * When a package.json file is read, this event fires with the contents. + * The package directory is available at pkg.__dirname. + */ + on(event: 'package', listener: (pkg: any) => any): BrowserifyObject; + /** + * When .bundle() is called, this event fires with the bundle output stream. + */ + on(event: 'bundle', listener: (bundle: NodeJS.ReadableStream) => any): BrowserifyObject; + /** + * When the .reset() method is called or implicitly called by another call to .bundle(), this event fires. + */ + on(event: 'reset', listener: () => any): BrowserifyObject; + /** + * When a transform is applied to a file, the 'transform' event fires on the bundle stream with the transform stream tr and the file that the transform is being applied to. + */ + on(event: 'transform', listener: (tr: NodeJS.ReadWriteStream, file: string) => any): BrowserifyObject; + on(event: string, listener: Function): BrowserifyObject; + + /** + * Set to any until substack/labeled-stream-splicer is defined + */ + pipeline: any; + } } declare module "browserify" { - var browserify: Browserify; + var browserify: Browserify.BrowserifyConstructor; export = browserify; } diff --git a/envify/envify.d.ts b/envify/envify.d.ts index 39479f503f..cc343ad33b 100644 --- a/envify/envify.d.ts +++ b/envify/envify.d.ts @@ -3,12 +3,14 @@ // Definitions by: Qubo // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module "envify" { - var envify: Function; + var envify: (file: string, environment: { [name: string]: any }) => NodeJS.ReadWriteStream; export = envify; } declare module "envify/custom" { - function envify(environment: { [name: string]: any }): Function; + function envify(environment: { [name: string]: any }): (file: string, environment: { [name: string]: any }) => NodeJS.ReadWriteStream; export = envify; } From 1d23a699bae66c613b7e8f68826eeef586b41f5e Mon Sep 17 00:00:00 2001 From: dencap Date: Fri, 20 Nov 2015 15:01:35 +0100 Subject: [PATCH 015/107] Fixed the signature of concat, that takes as input an array --- bytebuffer/bytebuffer.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bytebuffer/bytebuffer.d.ts b/bytebuffer/bytebuffer.d.ts index 0bfaed7c16..8f1a800eae 100644 --- a/bytebuffer/bytebuffer.d.ts +++ b/bytebuffer/bytebuffer.d.ts @@ -131,7 +131,7 @@ declare class ByteBuffer /** * Concatenates multiple ByteBuffers into one. */ - static concat( buffers: Array | ArrayBuffer | Uint8Array | string, encoding?: string | boolean, litteEndian?: boolean, noAssert?: boolean ): ByteBuffer; + static concat( buffers: Array, encoding?: string | boolean, litteEndian?: boolean, noAssert?: boolean ): ByteBuffer; /** * Decodes a base64 encoded string to a ByteBuffer. From 12c6eec04b615c5edfa8e4cf3ddbed7b60046e94 Mon Sep 17 00:00:00 2001 From: bgrieder Date: Sun, 22 Nov 2015 09:58:22 +0100 Subject: [PATCH 016/107] Improvements to Events System + PanResponder + PushNotificationIOS + StatusBarIOS + VibrationIOS --- react-native/react-native-tests.tsx | 8 +- react-native/react-native.d.ts | 375 ++++++++++++++++++++-------- 2 files changed, 265 insertions(+), 118 deletions(-) diff --git a/react-native/react-native-tests.tsx b/react-native/react-native-tests.tsx index 2783ebeb08..f2e4cc22f6 100644 --- a/react-native/react-native-tests.tsx +++ b/react-native/react-native-tests.tsx @@ -3,10 +3,8 @@ Note: This must be compiled with the target set to ES6 - The content of index.io.js could be something like - 'use strict'; import { AppRegistry } from 'react-native' @@ -15,11 +13,7 @@ The content of index.io.js could be something like AppRegistry.registerComponent('MopNative', () => Welcome); - - -NOTE: I (Bruno Grieder) complete these definitions as I port the UI Explorer to Typescript -If you are in a hurry for the latest definitions, or are looking for typescript examples, -check https://github.com/bgrieder/RNTSExplorer +For a list of complete Typescript examples: check https://github.com/bgrieder/RNTSExplorer */ diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index 60f8afd1a2..dacfbc7f08 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -7,15 +7,12 @@ // // These definitions are meant to be used with the TSC compiler target set to ES6 // +// These definitions have been mostly completed by porting to Typescript +// the UI Explorer which comes with the react-native distribution +// Check: https://github.com/bgrieder/RNTSExplorer +// // This work is based on an original work made by Bernd Paradies: https://github.com/bparadie // -// WARNING: this work is very much beta: -// -it is still missing react-native definitions (see below) -// -it re-exports the whole of react 0.14 which may not be what react-native actually does -// -// I (Bruno Grieder) complete these definitions as I port the UI Explorer to Typescript -// If you are in a hurry for the latest definitions, check those in https://github.com/bgrieder/RNTSExplorer -// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @@ -47,7 +44,7 @@ declare namespace ReactNative { // not in lib.es6.d.ts but called by react-native - done(callback?: (value: T) => void): void; + done( callback?: ( value: T ) => void ): void; } export interface PromiseConstructor { @@ -135,6 +132,73 @@ declare namespace ReactNative { export type Runnable = ( appParameters: any ) => void; + // Similar to React.SyntheticEvent except for nativeEvent + interface NativeSyntheticEvent { + bubbles: boolean + cancelable: boolean + currentTarget: EventTarget + defaultPrevented: boolean + eventPhase: number + isTrusted: boolean + nativeEvent: T + preventDefault(): void + stopPropagation(): void + target: EventTarget + timeStamp: Date + type: string + } + + export interface NativeTouchEvent { + /** + * Array of all touch events that have changed since the last event + */ + changedTouches: NativeTouchEvent[] + + /** + * The ID of the touch + */ + identifier: string + + /** + * The X position of the touch, relative to the element + */ + locationX: number + + /** + * The Y position of the touch, relative to the element + */ + locationY: number + + /** + * The X position of the touch, relative to the screen + */ + pageX: number + + /** + * The Y position of the touch, relative to the screen + */ + pageY: number + + /** + * The node id of the element receiving the touch event + */ + target: string + + /** + * A time identifier for the touch, useful for velocity calculation + */ + timestamp: number + + /** + * Array of all current touches on the screen + */ + touches : NativeTouchEvent[] + } + + export interface GestureResponderEvent extends NativeSyntheticEvent { + } + + export interface PointProperties { x: number y: number @@ -147,8 +211,23 @@ declare namespace ReactNative { right?: number } + /** + * //FIXME: need to find documentation on which compoenent is a native (i.e. non composite component) + */ export interface NativeComponent { - setNativeProps: (props: Object) => void + setNativeProps: ( props: Object ) => void + } + + /** + * //FIXME: need to find documentation on which component is a TTouchable and can implement that interface + * @see React.DOMAtributes + */ + export interface Touchable { + onTouchStart?: ( event: GestureResponderEvent ) => void + onTouchMove?: ( event: GestureResponderEvent ) => void + onTouchEnd?: ( event: GestureResponderEvent ) => void + onTouchCancel?: ( event: GestureResponderEvent ) => void + onTouchEndCapture?: ( event: GestureResponderEvent ) => void } export type AppConfig = { @@ -583,55 +662,6 @@ declare namespace ReactNative { } - export interface GestureResponderEvent { - nativeEvent : { - /** - * Array of all touch events that have changed since the last event - */ - changedTouches: any[] - - /** - * The ID of the touch - */ - identifier: string - - /** - * The X position of the touch, relative to the element - */ - locationX: number - - /** - * The Y position of the touch, relative to the element - */ - locationY: number - - /** - * The X position of the touch, relative to the screen - */ - pageX: number - - /** - * The Y position of the touch, relative to the screen - */ - pageY: number - - /** - * The node id of the element receiving the touch event - */ - target: string - - /** - * A time identifier for the touch, useful for velocity calculation - */ - timestamp: number - - /** - * Array of all current touches on the screen - */ - touches : any[] - } - } - /** * Gesture recognition on mobile devices is much more complicated than web. * A touch can go through several phases as the app determines what the user's intention is. @@ -667,12 +697,12 @@ declare namespace ReactNative { /** * Does this view want to become responder on the start of a touch? */ - onStartShouldSetResponder?: (event: GestureResponderEvent) => boolean + onStartShouldSetResponder?: ( event: GestureResponderEvent ) => boolean /** * Called for every touch move on the View when it is not the responder: does this view want to "claim" touch responsiveness? */ - onMoveShouldSetResponder?: (event: GestureResponderEvent) => boolean + onMoveShouldSetResponder?: ( event: GestureResponderEvent ) => boolean /** * If the View returns true and attempts to become the responder, one of the following will happen: @@ -682,12 +712,12 @@ declare namespace ReactNative { * The View is now responding for touch events. * This is the time to highlight and show the user what is happening */ - onResponderGrant?: (event: GestureResponderEvent) => void + onResponderGrant?: ( event: GestureResponderEvent ) => void /** * Something else is the responder right now and will not release it */ - onResponderReject?: (event: GestureResponderEvent) => void + onResponderReject?: ( event: GestureResponderEvent ) => void /** * If the view is responding, the following handlers can be called: @@ -696,25 +726,25 @@ declare namespace ReactNative { /** * The user is moving their finger */ - onResponderMove?: (event: GestureResponderEvent) => void + onResponderMove?: ( event: GestureResponderEvent ) => void /** * Fired at the end of the touch, ie "touchUp" */ - onResponderRelease?: (event: GestureResponderEvent) => void + onResponderRelease?: ( event: GestureResponderEvent ) => void /** * Something else wants to become responder. * Should this view release the responder? Returning true allows release */ - onResponderTerminationRequest?: (event: GestureResponderEvent) => boolean + onResponderTerminationRequest?: ( event: GestureResponderEvent ) => boolean /** * The responder has been taken from the View. * Might be taken by other views after a call to onResponderTerminationRequest, * or might be taken by the OS without asking (happens with control center/ notification center on iOS) */ - onResponderTerminate?: (event: GestureResponderEvent) => void + onResponderTerminate?: ( event: GestureResponderEvent ) => void /** * onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern, @@ -729,7 +759,7 @@ declare namespace ReactNative { * So if a parent View wants to prevent the child from becoming responder on a touch start, * it should have a onStartShouldSetResponderCapture handler which returns true. */ - onStartShouldSetResponderCapture?: (event: GestureResponderEvent) => boolean + onStartShouldSetResponderCapture?: ( event: GestureResponderEvent ) => boolean /** * onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern, @@ -864,7 +894,7 @@ declare namespace ReactNative { /** * @see https://facebook.github.io/react-native/docs/view.html#props */ - export interface ViewProperties extends ViewPropertiesAndroid, ViewPropertiesIOS, GestureResponderHandlers, React.Props { + export interface ViewProperties extends ViewPropertiesAndroid, ViewPropertiesIOS, GestureResponderHandlers, Touchable, React.Props { /** * Overrides the text that's read by the screen reader when the user interacts with the element. By default, the label is constructed by traversing all the children and accumulating all the Text nodes separated by space. @@ -1680,7 +1710,7 @@ declare namespace ReactNative { showsPointsOfInterest?: boolean } - export interface MapViewProperties extends MapViewPropertiesIOS, React.Props { + export interface MapViewProperties extends MapViewPropertiesIOS, Touchable, React.Props { /** * Map annotations with title/subtitle. @@ -2423,7 +2453,6 @@ declare namespace ReactNative { } - export interface PixelRatioStatic { get(): number; } @@ -2632,7 +2661,7 @@ declare namespace ReactNative { zoomScale?: number } - export interface ScrollViewProperties extends ScrollViewIOSProperties { + export interface ScrollViewProperties extends ScrollViewIOSProperties, Touchable { /** * These styles will be applied to the scroll view content container which @@ -2962,13 +2991,13 @@ declare namespace ReactNative { * eventName is expected to be `change` * //FIXME: No doc - inferred from NetInfo.js */ - addEventListener: (eventName: string, listener: (result: T) => void) => void + addEventListener: ( eventName: string, listener: ( result: T ) => void ) => void /** * eventName is expected to be `change` * //FIXME: No doc - inferred from NetInfo.js */ - removeEventListener: (eventName: string, listener: (result: T) => void) => void + removeEventListener: ( eventName: string, listener: ( result: T ) => void ) => void } /** @@ -2996,30 +3025,6 @@ declare namespace ReactNative { isConnectionMetered: any } - /** - * //FIXME: Documentation ? - */ - export interface PanResponderEvent { - - bubbles: boolean - cancelable: boolean - currentTarget: number - defaultPrevented: boolean - dispatchConfig: any - dispatchMarker: any - eventPhase: any - isDefaultPrevented: () => boolean - isPropagationStopped: () => boolean - isTrusted: boolean - nativeEvent: GestureResponderEvent - path: any - target: number - timeStamp: number - touchHistory: any[] - type: any - - } - export interface PanResponderGestureState { @@ -3083,19 +3088,19 @@ declare namespace ReactNative { * @see documentation of GestureResponderHandlers */ export interface PanResponderCallbacks { - onMoveShouldSetPanResponder?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean - onStartShouldSetPanResponder?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void - onPanResponderGrant?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void - onPanResponderMove?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void - onPanResponderRelease?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void - onPanResponderTerminate?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void + onMoveShouldSetPanResponder?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => boolean + onStartShouldSetPanResponder?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void + onPanResponderGrant?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void + onPanResponderMove?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void + onPanResponderRelease?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void + onPanResponderTerminate?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void - onMoveShouldSetPanResponderCapture?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean - onStartShouldSetPanResponderCapture?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean - onPanResponderReject?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void - onPanResponderStart?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void - onPanResponderEnd?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void - onPanResponderTerminationRequest?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean + onMoveShouldSetPanResponderCapture?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => boolean + onStartShouldSetPanResponderCapture?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => boolean + onPanResponderReject?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void + onPanResponderStart?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void + onPanResponderEnd?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void + onPanResponderTerminationRequest?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => boolean } export interface PanResponderInstance { @@ -3145,7 +3150,143 @@ declare namespace ReactNative { create( config: PanResponderCallbacks ): PanResponderInstance } + export interface PushNotificationPermissions { + alert?: boolean + badge?: boolean + sound?: boolean + } + export interface PushNotification { + + + /** + * An alias for `getAlert` to get the notification's main message string + */ + getMessage(): string | Object + + /** + * Gets the sound string from the `aps` object + */ + getSound(): string + + /** + * Gets the notification's main message from the `aps` object + */ + getAlert(): string | Object + + /** + * Gets the badge count number from the `aps` object + */ + getBadgeCount(): number + + /** + * Gets the data object on the notif + */ + getData(): Object + + } + + + /** + * Handle push notifications for your app, including permission handling and icon badge number. + * @see https://facebook.github.io/react-native/docs/pushnotificationios.html#content + * + * //FIXME: BGR: The documentation seems completely off compared to the actual js implementation. I could never get the example to run + */ + export interface PushNotificationIOSStatic { + + /** + * Sets the badge number for the app icon on the home screen + */ + setApplicationIconBadgeNumber( number: number ): void + + /** + * Gets the current badge number for the app icon on the home screen + */ + getApplicationIconBadgeNumber( callback: ( badge: number ) => void ): void + + /** + * Attaches a listener to remote notifications while the app is running in the + * foreground or the background. + * + * The handler will get be invoked with an instance of `PushNotificationIOS` + * + * The type MUST be 'notification' + */ + addEventListener( type: string, handler: ( notification: PushNotification ) => void ):void + + /** + * Requests all notification permissions from iOS, prompting the user's + * dialog box. + */ + requestPermissions(): void + + /** + * See what push permissions are currently enabled. `callback` will be + * invoked with a `permissions` object: + * + * - `alert` :boolean + * - `badge` :boolean + * - `sound` :boolean + */ + checkPermissions( callback: ( permissions: PushNotificationPermissions ) => void ): void + + /** + * Removes the event listener. Do this in `componentWillUnmount` to prevent + * memory leaks + */ + removeEventListener( type: string, handler: ( notification: PushNotification ) => void ): void + + /** + * An initial notification will be available if the app was cold-launched + * from a notification. + * + * The first caller of `popInitialNotification` will get the initial + * notification object, or `null`. Subsequent invocations will return null. + */ + popInitialNotification(): PushNotification + } + + + /** + * @enum('default', 'light-content') + */ + export type StatusBarStyle = string + + /** + * @enum('none','fade', 'slide') + */ + type StatusBarAnimation = string + + + /** + * //FIXME: No documentation is available (although this is self explanatory) + * + * @see https://facebook.github.io/react-native/docs/statusbarios.html#content + */ + export interface StatusBarIOSStatic { + + setStyle(style: StatusBarStyle, animated?: boolean): void + + setHidden(hidden: boolean, animation?: StatusBarAnimation): void + + setNetworkActivityIndicatorVisible(visible: boolean): void + } + + /** + * The Vibration API is exposed at VibrationIOS.vibrate(). + * On iOS, calling this function will trigger a one second vibration. + * The vibration is asynchronous so this method will return immediately. + * + * There will be no effect on devices that do not support Vibration, eg. the iOS simulator. + * + * Vibration patterns are currently unsupported. + * + * @see https://facebook.github.io/react-native/docs/vibrationios.html#content + */ + export interface VibrationIOSStatic { + vibrate(): void + } ////////////////////////////////////////////////////////////////////////// // @@ -3248,6 +3389,20 @@ declare namespace ReactNative { export var PanResponder: PanResponderStatic export type PanResponder = PanResponderStatic + export var PushNotificationIOS: PushNotificationIOSStatic + export type PushNotificationIOS = PushNotificationIOSStatic + + export var StatusBarIOS: StatusBarIOSStatic + export type StatusBarIOS = StatusBarIOSStatic + + export var VibrationIOS: VibrationIOSStatic + export type VibrationIOS = VibrationIOSStatic + + + // + // /TODO: BGR: These are leftovers of the initial port that must be revisited + // + export var SegmentedControlIOS: React.ComponentClass export var PixelRatio: PixelRatioStatic @@ -3257,8 +3412,6 @@ declare namespace ReactNative { export var InteractionManager: InteractionManagerStatic - - ////////////////////////////////////////////////////////////////////////// // // R E A C T - 0 . 1 4 From 66efc690ae79f9c43f7f9fbbaa1910fd1f3a9310 Mon Sep 17 00:00:00 2001 From: zoetrope Date: Mon, 23 Nov 2015 15:38:59 +0900 Subject: [PATCH 017/107] ui-grid: fixed type for SELECT filter --- ui-grid/ui-grid.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 06d6314c03..e6dd7468d0 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -3857,7 +3857,7 @@ declare module uiGrid { * defaults to uiGridConstants.filter.INPUT, which gives a text box. If set to uiGridConstants.filter.SELECT * then a select box will be shown with options selectOptions */ - type?: number; + type?: number | string; /** * options in the format [{ value: 1, label: 'male' }]. No i18n filter is provided, you need to perform the i18n * on the values before you provide them @@ -3870,7 +3870,7 @@ declare module uiGrid { disableCancelButton?: boolean; } export interface ISelectOption { - value: number; + value: number | string; label: string; } From bfe9aff4a027ce97032b1e656a5014a2e93d57c4 Mon Sep 17 00:00:00 2001 From: Dan Lewi Harkestad Date: Mon, 23 Nov 2015 10:39:49 +0100 Subject: [PATCH 018/107] Fixed a comma that should've been a semicolon. --- highcharts/highcharts.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index 94277ca252..e86d4b86c4 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -1304,7 +1304,7 @@ interface HighchartsChartOptions3dFrame { * @default 'transparent' * @since 4.0 */ - color?: string | HighchartsGradient, + color?: string | HighchartsGradient; /** * Thickness of the panel. * @default 1 From 8432f317395297cda689ec3468f656f0354bbc98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Par=C3=A9?= Date: Mon, 23 Nov 2015 19:07:55 -0500 Subject: [PATCH 019/107] Add p2.js Type definitions I did it for him https://github.com/clark-stevenson/p2.d.ts/issues/1 --- p2/p2-tests.d.ts | 45 +++ p2/p2.d.ts | 1005 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1050 insertions(+) create mode 100644 p2/p2-tests.d.ts create mode 100644 p2/p2.d.ts diff --git a/p2/p2-tests.d.ts b/p2/p2-tests.d.ts new file mode 100644 index 0000000000..63c213321c --- /dev/null +++ b/p2/p2-tests.d.ts @@ -0,0 +1,45 @@ +/// + +// Create a physics world, where bodies and constraints live +var world = new p2.World({ + gravity:[0, -9.82] +}); + +// Create an empty dynamic body +var circleBody = new p2.Body({ + mass: 5, + position: [0, 10] +}); + +// Add a circle shape to the body. +var circleShape = new p2.Circle({ radius: 1 }); +circleBody.addShape(circleShape); + +// ...and add the body to the world. +// If we don't add it to the world, it won't be simulated. +world.addBody(circleBody); + +// Create an infinite ground plane. +var groundBody = new p2.Body({ + mass: 0 // Setting mass to 0 makes the body static +}); +var groundShape = new p2.Plane(); +groundBody.addShape(groundShape); +world.addBody(groundBody); + +// To get the trajectories of the bodies, +// we must step the world forward in time. +// This is done using a fixed time step size. +var timeStep = 1 / 60; // seconds + +// The "Game loop". Could be replaced by, for example, requestAnimationFrame. +setInterval(function(){ + + // The step method moves the bodies forward in time. + world.step(timeStep); + + // Print the circle position to console. + // Could be replaced by a render call. + console.log("Circle y position: " + circleBody.position[1]); + +}, 1000 * timeStep); diff --git a/p2/p2.d.ts b/p2/p2.d.ts new file mode 100644 index 0000000000..a0e3f8b6af --- /dev/null +++ b/p2/p2.d.ts @@ -0,0 +1,1005 @@ +// Type definitions for p2.js v0.7.1 +// Project: https://github.com/schteppe/p2.js/ +// Definitions by: Clark Stevenson +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module p2 { + + export class AABB { + + constructor(options?: { + upperBound?: number[]; + lowerBound?: number[]; + }); + + setFromPoints(points: number[][], position: number[], angle: number, skinSize: number): void; + copy(aabb: AABB): void; + extend(aabb: AABB): void; + overlaps(aabb: AABB): boolean; + + } + + export class Broadphase { + + static AABB: number; + static BOUNDING_CIRCLE: number; + + static NAIVE: number; + static SAP: number; + + static boundingRadiusCheck(bodyA: Body, bodyB: Body): boolean; + static aabbCheck(bodyA: Body, bodyB: Body): boolean; + static canCollide(bodyA: Body, bodyB: Body): boolean; + + constructor(type: number); + + type: number; + result: Body[]; + world: World; + boundingVolumeType: number; + + setWorld(world: World): void; + getCollisionPairs(world: World): Body[]; + boundingVolumeCheck(bodyA: Body, bodyB: Body): boolean; + + } + + export class GridBroadphase extends Broadphase { + + constructor(options?: { + xmin?: number; + xmax?: number; + ymin?: number; + ymax?: number; + nx?: number; + ny?: number; + }); + + xmin: number; + xmax: number; + ymin: number; + ymax: number; + nx: number; + ny: number; + binsizeX: number; + binsizeY: number; + + } + + export class NativeBroadphase extends Broadphase { + + } + + export class Narrowphase { + + contactEquations: ContactEquation[]; + frictionEquations: FrictionEquation[]; + enableFriction: boolean; + enableEquations: boolean; + slipForce: number; + frictionCoefficient: number; + surfaceVelocity: number; + reuseObjects: boolean; + resuableContactEquations: any[]; + reusableFrictionEquations: any[]; + restitution: number; + stiffness: number; + relaxation: number; + frictionStiffness: number; + frictionRelaxation: number; + enableFrictionReduction: boolean; + contactSkinSize: number; + + collidedLastStep(bodyA: Body, bodyB: Body): boolean; + reset(): void; + createContactEquation(bodyA: Body, bodyB: Body, shapeA: Shape, shapeB: Shape): ContactEquation; + createFrictionFromContact(c: ContactEquation): FrictionEquation; + + } + + export class SAPBroadphase extends Broadphase { + + axisList: Body[]; + axisIndex: number; + + } + + export class Constraint { + + static DISTANCE: number; + static GEAR: number; + static LOCK: number; + static PRISMATIC: number; + static REVOLUTE: number; + + constructor(bodyA: Body, bodyB: Body, type: number, options?: { + collideConnected?: boolean; + wakeUpBodies?: boolean; + }); + + type: number; + equeations: Equation[]; + bodyA: Body; + bodyB: Body; + collideConnected: boolean; + + update(): void; + setStiffness(stiffness: number): void; + setRelaxation(relaxation: number): void; + + } + + export class DistanceConstraint extends Constraint { + + constructor(bodyA: Body, bodyB: Body, type: number, options?: { + collideConnected?: boolean; + wakeUpBodies?: boolean; + distance?: number; + localAnchorA?: number[]; + localAnchorB?: number[]; + maxForce?: number; + }); + + localAnchorA: number[]; + localAnchorB: number[]; + distance: number; + maxForce: number; + upperLimitEnabled: boolean; + upperLimit: number; + lowerLimitEnabled: boolean; + lowerLimit: number; + position: number; + + setMaxForce(f: number): void; + getMaxForce(): number; + + } + + export class GearConstraint extends Constraint { + + constructor(bodyA: Body, bodyB: Body, type: number, options?: { + collideConnected?: boolean; + wakeUpBodies?: boolean; + angle?: number; + ratio?: number; + maxTorque?: number; + }); + + ratio: number; + angle: number; + + setMaxTorque(torque: number): void; + getMaxTorque(): number; + + } + + export class LockConstraint extends Constraint { + + constructor(bodyA: Body, bodyB: Body, type: number, options?: { + collideConnected?: boolean; + wakeUpBodies?: boolean; + localOffsetB?: number[]; + localAngleB?: number; + maxForce?: number; + }); + + setMaxForce(force: number): void; + getMaxForce(): number; + + } + + export class PrismaticConstraint extends Constraint { + + constructor(bodyA: Body, bodyB: Body, type: number, options?: { + collideConnected?: boolean; + wakeUpBodies?: boolean; + maxForce?: number; + localAnchorA?: number[]; + localAnchorB?: number[]; + localAxisA?: number[]; + disableRotationalLock?: boolean; + upperLimit?: number; + lowerLimit?: number; + }); + + localAnchorA: number[]; + localAnchorB: number[]; + localAxisA: number[]; + position: number; + velocity: number; + lowerLimitEnabled: boolean; + upperLimitEnabled: boolean; + lowerLimit: number; + upperLimit: number; + upperLimitEquation: ContactEquation; + lowerLimitEquation: ContactEquation; + motorEquation: Equation; + motorEnabled: boolean; + motorSpeed: number; + + enableMotor(): void; + disableMotor(): void; + setLimits(lower: number, upper: number): void; + + } + + export class RevoluteConstraint extends Constraint { + + constructor(bodyA: Body, bodyB: Body, type: number, options?: { + collideConnected?: boolean; + wakeUpBodies?: boolean; + worldPivot?: number[]; + localPivotA?: number[]; + localPivotB?: number[]; + maxForce?: number; + }); + + pivotA: number[]; + pivotB: number[]; + motorEquation: RotationalVelocityEquation; + motorEnabled: boolean; + angle: number; + lowerLimitEnabled: boolean; + upperLimitEnabled: boolean; + lowerLimit: number; + upperLimit: number; + upperLimitEquation: ContactEquation; + lowerLimitEquation: ContactEquation; + + enableMotor(): void; + disableMotor(): void; + motorIsEnabled(): boolean; + setLimits(lower: number, upper: number): void; + setMotorSpeed(speed: number): void; + getMotorSpeed(): number; + + } + + export class AngleLockEquation extends Equation { + + constructor(bodyA: Body, bodyB: Body, options?: { + angle?: number; + ratio?: number; + }); + + computeGq(): number; + setRatio(ratio: number): number; + setMaxTorque(torque: number): number; + + } + + export class ContactEquation extends Equation { + + constructor(bodyA: Body, bodyB: Body); + + contactPointA: number[]; + penetrationVec: number[]; + contactPointB: number[]; + normalA: number[]; + restitution: number; + firstImpact: boolean; + shapeA: Shape; + shapeB: Shape; + + computeB(a: number, b: number, h: number): number; + + } + + export class Equation { + + static DEFAULT_STIFFNESS: number; + static DEFAULT_RELAXATION: number; + + constructor(bodyA: Body, bodyB: Body, minForce?: number, maxForce?: number); + + minForce: number; + maxForce: number; + bodyA: Body; + bodyB: Body; + stiffness: number; + relaxation: number; + G: number[]; + offset: number; + a: number; + b: number; + epsilon: number; + timeStep: number; + needsUpdate: boolean; + multiplier: number; + relativeVelocity: number; + enabled: boolean; + + gmult(G: number[], vi: number[], wi: number[], vj: number[], wj: number[]): number; + computeB(a: number, b: number, h: number): number; + computeGq(): number; + computeGW(): number; + computeGWlambda(): number; + computeGiMf(): number; + computeGiMGt(): number; + addToWlambda(deltalambda: number): number; + computeInvC(eps: number): number; + + } + + export class FrictionEquation extends Equation { + + constructor(bodyA: Body, bodyB: Body, slipForce: number); + + contactPointA: number[]; + contactPointB: number[]; + t: number[]; + shapeA: Shape; + shapeB: Shape; + frictionCoefficient: number; + + setSlipForce(slipForce: number): number; + getSlipForce(): number; + computeB(a: number, b: number, h: number): number; + + } + + export class RotationalLockEquation extends Equation { + + constructor(bodyA: Body, bodyB: Body, options?: { + angle?: number; + }); + + angle: number; + + computeGq(): number; + + } + + export class RotationalVelocityEquation extends Equation { + + constructor(bodyA: Body, bodyB: Body); + + computeB(a: number, b: number, h: number): number; + + } + + export class EventEmitter { + + on(type: string, listener: Function, context: any): EventEmitter; + has(type: string, listener: Function): boolean; + off(type: string, listener: Function): EventEmitter; + emit(event: any): EventEmitter; + + } + + export class ContactMaterialOptions { + + friction: number; + restitution: number; + stiffness: number; + relaxation: number; + frictionStiffness: number; + frictionRelaxation: number; + surfaceVelocity: number; + + } + + export class ContactMaterial { + + static idCounter: number; + + constructor(materialA: Material, materialB: Material, options?: ContactMaterialOptions); + + id: number; + materialA: Material; + materialB: Material; + friction: number; + restitution: number; + stiffness: number; + relaxation: number; + frictionStuffness: number; + frictionRelaxation: number; + surfaceVelocity: number; + contactSkinSize: number; + + } + + export class Material { + + static idCounter: number; + + constructor(id: number); + + id: number; + + } + + export class vec2 { + + static crossLength(a: number[], b: number[]): number; + static crossVZ(out: number[], vec: number[], zcomp: number): number; + static crossZV(out: number[], zcomp: number, vec: number[]): number; + static rotate(out: number[], a: number[], angle: number): void; + static rotate90cw(out: number[], a: number[]): number; + static centroid(out: number[], a: number[], b: number[], c: number[]): number[]; + static create(): number[]; + static clone(a: number[]): number[]; + static fromValues(x: number, y: number): number[]; + static copy(out: number[], a: number[]): number[]; + static set(out: number[], x: number, y: number): number[]; + static toLocalFrame(out: number[], worldPoint: number[], framePosition: number[], frameAngle: number): void; + static toGlobalFrame(out: number[], localPoint: number[], framePosition: number[], frameAngle: number): void; + static add(out: number[], a: number[], b: number[]): number[]; + static subtract(out: number[], a: number[], b: number[]): number[]; + static sub(out: number[], a: number[], b: number[]): number[]; + static multiply(out: number[], a: number[], b: number[]): number[]; + static mul(out: number[], a: number[], b: number[]): number[]; + static divide(out: number[], a: number[], b: number[]): number[]; + static div(out: number[], a: number[], b: number[]): number[]; + static scale(out: number[], a: number[], b: number): number[]; + static distance(a: number[], b: number[]): number; + static dist(a: number[], b: number[]): number; + static squaredDistance(a: number[], b: number[]): number; + static sqrDist(a: number[], b: number[]): number; + static length(a: number[]): number; + static len(a: number[]): number; + static squaredLength(a: number[]): number; + static sqrLen(a: number[]): number; + static negate(out: number[], a: number[]): number[]; + static normalize(out: number[], a: number[]): number[]; + static dot(a: number[], b: number[]): number; + static str(a: number[]): string; + + } + + export interface BodyOptions { + + mass?: number; + position?: number[]; + velocity?: number[]; + angle?: number; + angularVelocity?: number; + force?: number[]; + angularForce?: number; + fixedRotation?: boolean; + + } + + export class Body extends EventEmitter { + + sleepyEvent: { + type: string; + }; + + sleepEvent: { + type: string; + }; + + wakeUpEvent: { + type: string; + }; + + static DYNAMIC: number; + static STATIC: number; + static KINEMATIC: number; + static AWAKE: number; + static SLEEPY: number; + static SLEEPING: number; + + constructor(options?: BodyOptions); + + id: number; + world: World; + shapes: Shape[]; + mass: number; + invMass: number; + inertia: number; + invInertia: number; + invMassSolve: number; + invInertiaSolve: number; + fixedRotation: number; + position: number[]; + interpolatedPosition: number[]; + interpolatedAngle: number; + previousPosition: number[]; + previousAngle: number; + velocity: number[]; + vlambda: number[]; + wlambda: number[]; + angle: number; + angularVelocity: number; + force: number[]; + angularForce: number; + damping: number; + angularDamping: number; + type: number; + boundingRadius: number; + aabb: AABB; + aabbNeedsUpdate: boolean; + allowSleep: boolean; + wantsToSleep: boolean; + sleepState: number; + sleepSpeedLimit: number; + sleepTimeLimit: number; + gravityScale: number; + collisionResponse: boolean; + + updateSolveMassProperties(): void; + setDensity(density: number): void; + getArea(): number; + getAABB(): AABB; + updateAABB(): void; + updateBoundingRadius(): void; + addShape(shape: Shape, offset?: number[], angle?: number): void; + removeShape(shape: Shape): boolean; + updateMassProperties(): void; + applyForce(force: number[], worldPoint: number[]): void; + toLocalFrame(out: number[], worldPoint: number[]): void; + toWorldFrame(out: number[], localPoint: number[]): void; + fromPolygon(path: number[][], options?: { + optimalDecomp?: boolean; + skipSimpleCheck?: boolean; + removeCollinearPoints?: any; //boolean | number + }): boolean; + adjustCenterOfMass(): void; + setZeroForce(): void; + resetConstraintVelocity(): void; + applyDamping(dy: number): void; + wakeUp(): void; + sleep(): void; + sleepTick(time: number, dontSleep: boolean, dt: number): void; + getVelocityFromPosition(story: number[], dt: number): number[]; + getAngularVelocityFromPosition(timeStep: number): number; + overlaps(body: Body): boolean; + + } + + export class Spring { + + constructor(bodyA: Body, bodyB: Body, options?: { + + stiffness?: number; + damping?: number; + localAnchorA?: number[]; + localAnchorB?: number[]; + worldAnchorA?: number[]; + worldAnchorB?: number[]; + + }); + + stiffness: number; + damping: number; + bodyA: Body; + bodyB: Body; + + applyForce(): void; + + } + + export class LinearSpring extends Spring { + + localAnchorA: number[]; + localAnchorB: number[]; + restLength: number; + + setWorldAnchorA(worldAnchorA: number[]): void; + setWorldAnchorB(worldAnchorB: number[]): void; + getWorldAnchorA(result: number[]): number[]; + getWorldAnchorB(result: number[]): number[]; + applyForce(): void; + + } + + export class RotationalSpring extends Spring { + + constructor(bodyA: Body, bodyB: Body, options?: { + restAngle?: number; + stiffness?: number; + damping?: number; + }); + + restAngle: number; + + } + + export interface CapsuleOptions extends SharedShapeOptions { + + length?: number; + radius?: number; + + } + + export class Capsule extends Shape { + + constructor(options?: CapsuleOptions); + + length: number; + radius: number; + + } + + export interface CircleOptions extends SharedShapeOptions { + + radius?: number; + + } + + export class Circle extends Shape { + + constructor(options?: CircleOptions); + + radius: number; + + } + + export interface ConvexOptions extends SharedShapeOptions { + + length?: number; + radius?: number; + + } + + export class Convex extends Shape { + + static triangleArea(a: number[], b: number[], c: number[]): number; + + constructor(options?: ConvexOptions); + + vertices: number[][]; + axes: number[]; + centerOfMass: number[]; + triangles: number[]; + boundingRadius: number; + + projectOntoLocalAxis(localAxis: number[], result: number[]): void; + projectOntoWorldAxis(localAxis: number[], shapeOffset: number[], shapeAngle: number, result: number[]): void; + + updateCenterOfMass(): void; + + } + + export interface HeightfieldOptions extends SharedShapeOptions { + + heights?: number[]; + minValue?: number; + maxValue?: number; + elementWidth?: number; + + } + + export class Heightfield extends Shape { + + constructor(options?: HeightfieldOptions); + + data: number[]; + maxValue: number; + minValue: number; + elementWidth: number; + + } + + export interface SharedShapeOptions { + + position?: number[]; + angle?: number; + collisionGroup?: number; + collisionResponse?: boolean; + collisionMask?: number; + sensor?: boolean; + + } + + export interface ShapeOptions extends SharedShapeOptions { + + type?: number; + + } + + export class Shape { + + static idCounter: number; + static CIRCLE: number; + static PARTICLE: number; + static PLANE: number; + static CONVEX: number; + static LINE: number; + static BOX: number; + static CAPSULE: number; + static HEIGHTFIELD: number; + + constructor(options?: ShapeOptions); + + type: number; + id: number; + position: number[]; + angle: number; + boundingRadius: number; + collisionGroup: number; + collisionResponse: boolean; + collisionMask: number; + material: Material; + area: number; + sensor: boolean; + + computeMomentOfInertia(mass: number): number; + updateBoundingRadius(): number; + updateArea(): void; + computeAABB(out: AABB, position: number[], angle: number): void; + + } + + export interface LineOptions extends SharedShapeOptions { + + length?: number; + + } + + export class Line extends Shape { + + constructor(options?: LineOptions); + + length: number; + + } + + export class Particle extends Shape { + + constructor(options?: SharedShapeOptions); + + } + + export class Plane extends Shape { + + constructor(options?: SharedShapeOptions); + + } + + export interface BoxOptions { + + width?: number; + height?: number; + + } + + export class Box extends Shape { + + constructor(options?: BoxOptions); + + width: number; + height: number; + + } + + export class Solver extends EventEmitter { + + static GS: number; + static ISLAND: number; + + constructor(options?: {}, type?: number); + + type: number; + equations: Equation[]; + equationSortFunction: Equation; //Equation | boolean + + solve(dy: number, world: World): void; + solveIsland(dy: number, island: Island): void; + sortEquations(): void; + addEquation(eq: Equation): void; + addEquations(eqs: Equation[]): void; + removeEquation(eq: Equation): void; + removeAllEquations(): void; + + } + + export class GSSolver extends Solver { + + constructor(options?: { + iterations?: number; + tolerance?: number; + }); + + iterations: number; + tolerance: number; + useZeroRHS: boolean; + frictionIterations: number; + usedIterations: number; + + solve(h: number, world: World): void; + + } + + export class OverlapKeeper { + + constructor(bodyA: Body, shapeA: Shape, bodyB: Body, shapeB: Shape); + + shapeA: Shape; + shapeB: Shape; + bodyA: Body; + bodyB: Body; + + tick(): void; + setOverlapping(bodyA: Body, shapeA: Shape, bodyB: Body, shapeB: Body): void; + bodiesAreOverlapping(bodyA: Body, bodyB: Body): boolean; + set(bodyA: Body, shapeA: Shape, bodyB: Body, shapeB: Shape): void; + + } + + export class TupleDictionary { + + data: number[]; + keys: number[]; + + getKey(id1: number, id2: number): string; + getByKey(key: number): number; + get(i: number, j: number): number; + set(i: number, j: number, value: number): number; + reset(): void; + copy(dict: TupleDictionary): void; + + } + + export class Utils { + + static appendArray(a: Array, b: Array): Array; + static splice(array: Array, index: number, howMany: number): void; + static extend(a: any, b: any): void; + static defaults(options: any, defaults: any): any; + + } + + export class Island { + + equations: Equation[]; + bodies: Body[]; + + reset(): void; + getBodies(result: any): Body[]; + wantsToSleep(): boolean; + sleep(): boolean; + + } + + export class IslandManager extends Solver { + + static getUnvisitedNode(nodes: IslandNode[]): IslandNode; // IslandNode | boolean + + equations: Equation[]; + islands: Island[]; + nodes: IslandNode[]; + + visit(node: IslandNode, bds: Body[], eqs: Equation[]): void; + bfs(root: IslandNode, bds: Body[], eqs: Equation[]): void; + split(world: World): Island[]; + + } + + export class IslandNode { + + constructor(body: Body); + + body: Body; + neighbors: IslandNode[]; + equations: Equation[]; + visited: boolean; + + reset(): void; + + } + + export class World extends EventEmitter { + + postStepEvent: { + type: string; + }; + + addBodyEvent: { + type: string; + }; + + removeBodyEvent: { + type: string; + }; + + addSpringEvent: { + type: string; + }; + + impactEvent: { + type: string; + bodyA: Body; + bodyB: Body; + shapeA: Shape; + shapeB: Shape; + contactEquation: ContactEquation; + }; + + postBroadphaseEvent: { + type: string; + pairs: Body[]; + }; + + beginContactEvent: { + type: string; + shapeA: Shape; + shapeB: Shape; + bodyA: Body; + bodyB: Body; + contactEquations: ContactEquation[]; + }; + + endContactEvent: { + type: string; + shapeA: Shape; + shapeB: Shape; + bodyA: Body; + bodyB: Body; + }; + + preSolveEvent: { + type: string; + contactEquations: ContactEquation[]; + frictionEquations: FrictionEquation[]; + }; + + static NO_SLEEPING: number; + static BODY_SLEEPING: number; + static ISLAND_SLEEPING: number; + + static integrateBody(body: Body, dy: number): void; + + constructor(options?: { + solver?: Solver; + gravity?: number[]; + broadphase?: Broadphase; + islandSplit?: boolean; + doProfiling?: boolean; + }); + + springs: Spring[]; + bodies: Body[]; + solver: Solver; + narrowphase: Narrowphase; + islandManager: IslandManager; + gravity: number[]; + frictionGravity: number; + useWorldGravityAsFrictionGravity: boolean; + useFrictionGravityOnZeroGravity: boolean; + doProfiling: boolean; + lastStepTime: number; + broadphase: Broadphase; + constraints: Constraint[]; + defaultMaterial: Material; + defaultContactMaterial: ContactMaterial; + lastTimeStep: number; + applySpringForces: boolean; + applyDamping: boolean; + applyGravity: boolean; + solveConstraints: boolean; + contactMaterials: ContactMaterial[]; + time: number; + stepping: boolean; + islandSplit: boolean; + emitImpactEvent: boolean; + sleepMode: number; + + addConstraint(c: Constraint): void; + addContactMaterial(contactMaterial: ContactMaterial): void; + removeContactMaterial(cm: ContactMaterial): void; + getContactMaterial(materialA: Material, materialB: Material): ContactMaterial; // ContactMaterial | boolean + removeConstraint(c: Constraint): void; + step(dy: number, timeSinceLastCalled?: number, maxSubSteps?: number): void; + runNarrowphase(np: Narrowphase, bi: Body, si: Shape, xi: any[], ai: number, bj: Body, sj: Shape, xj: any[], aj: number, cm: number, glen: number): void; + addSpring(s: Spring): void; + removeSpring(s: Spring): void; + addBody(body: Body): void; + removeBody(body: Body): void; + getBodyByID(id: number): Body; //Body | boolean + disableBodyCollision(bodyA: Body, bodyB: Body): void; + enableBodyCollision(bodyA: Body, bodyB: Body): void; + clear(): void; + clone(): World; + hitTest(worldPoint: number[], bodies: Body[], precision: number): Body[]; + setGlobalEquationParameters(parameters: { + relaxation?: number; + stiffness?: number; + }): void; + setGlobalStiffness(stiffness: number): void; + setGlobalRelaxation(relaxation: number): void; + } + +} From f1e51ed6ee399c74842fa71453a227f9b74d6fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Par=C3=A9?= Date: Mon, 23 Nov 2015 19:24:58 -0500 Subject: [PATCH 020/107] rename test file --- p2/{p2-tests.d.ts => p2-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename p2/{p2-tests.d.ts => p2-tests.ts} (100%) diff --git a/p2/p2-tests.d.ts b/p2/p2-tests.ts similarity index 100% rename from p2/p2-tests.d.ts rename to p2/p2-tests.ts From b30dbc4dd32b3237cd78e9139c3fc270caaacacb Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Tue, 24 Nov 2015 11:25:05 +0100 Subject: [PATCH 021/107] Update SuperAgent to version 1.4.0 - Callback now always takes 2 arguments, see https://github.com/visionmedia/superagent/commit/e440274 - Add Request.use() - Improve tests --- superagent/superagent-tests.ts | 39 +++++++++++++++++++++++++++------- superagent/superagent.d.ts | 5 +++-- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/superagent/superagent-tests.ts b/superagent/superagent-tests.ts index 466fc33a12..58b6840440 100644 --- a/superagent/superagent-tests.ts +++ b/superagent/superagent-tests.ts @@ -1,17 +1,20 @@ -/// +/// /// // via: http://visionmedia.github.io/superagent/ -import request = require('superagent') -import fs = require('fs'); +import * as request from 'superagent'; +import * as fs from 'fs'; + +// Examples taken from https://github.com/visionmedia/superagent/blob/gh-pages/docs/index.md +// and https://github.com/visionmedia/superagent/blob/master/Readme.md request .post('/api/pet') .send({ name: 'Manny', species: 'cat' }) .set('X-API-Key', 'foobar') .set('Accept', 'application/json') - .end((res: request.Response) => { + .end((err, res) => { if (res.ok) { console.log('yay got ' + JSON.stringify(res.body)); } else { @@ -25,7 +28,7 @@ agent .send({ name: 'Manny', species: 'cat' }) .set('X-API-Key', 'foobar') .set('Accept', 'application/json') - .end((res: request.Response) => { + .end((err, res) => { if (res.error) { console.log('oh no ' + res.error.message); } else { @@ -33,8 +36,19 @@ agent } }); +// Plugins +var nocache = require('superagent-no-cache'); +var prefix = require('superagent-prefix')('/static'); -var callback = (res: request.Response) => {}; +request + .get('/some-url') + .use(prefix) // Prefixes *only* this request + .use(nocache) // Prevents caching of *only* this request + .end(function(err, res){ + // Do something + }); + +var callback = (err: any, res: request.Response) => {}; // Request basics request @@ -44,6 +58,10 @@ request request('GET', '/search') .end(callback); +request + .get('http://example.com/search') + .end(callback); + request .head('/favicon.ico') .end(callback); @@ -100,6 +118,12 @@ request .query('range=1..5') .end(callback); +// HEAD requests +request + .head('/users') + .query({ email: 'joe@smith.com' }) + .end(callback); + // POST / PUT requests request.post('/user') .set('Content-Type', 'application/json') @@ -139,6 +163,7 @@ request.post('/user') request.post('/user') .type('png'); +// Setting Accept request.get('/user') .accept('application/json'); @@ -254,5 +279,3 @@ request .attach('image', 'path/to/tobi.png') .on('error', (err: any) => {}) .end(callback); - - diff --git a/superagent/superagent.d.ts b/superagent/superagent.d.ts index a5118a7645..493d287efb 100644 --- a/superagent/superagent.d.ts +++ b/superagent/superagent.d.ts @@ -1,4 +1,4 @@ -// Type definitions for SuperAgent 0.15.4 +// Type definitions for SuperAgent v1.4.0 // Project: https://github.com/visionmedia/superagent // Definitions by: Alex Varju // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -8,7 +8,7 @@ declare module "superagent" { import stream = require('stream'); - type CallbackHandler = { (err: any, res: request.Response): void; }|{ (res: request.Response): void; }; + type CallbackHandler = (err: any, res: request.Response) => void; var request: request.SuperAgentStatic; @@ -102,6 +102,7 @@ declare module "superagent" { set(field: Object): Req; timeout(ms: number): Req; type(val: string): Req; + use(fn: Function): Req; withCredentials(): Req; write(data: string, encoding?: string): Req; write(data: Buffer, encoding?: string): Req; From 15852a714521bb27a8b4e129c7f48e7e1046cfdb Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Tue, 24 Nov 2015 11:27:45 +0100 Subject: [PATCH 022/107] Update SuperTest to version 1.1.0 - Callback now always takes 2 arguments, see https://github.com/visionmedia/superagent/commit/e440274 - Override superagent.Request.end() so it takes the proper callback signature --- supertest/supertest-tests.ts | 7 +++---- supertest/supertest.d.ts | 5 +++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/supertest/supertest-tests.ts b/supertest/supertest-tests.ts index d76c97ea48..5e0de8ad8c 100644 --- a/supertest/supertest-tests.ts +++ b/supertest/supertest-tests.ts @@ -1,8 +1,8 @@ /// /// -import supertest = require('supertest') -import express = require('express'); +import * as supertest from 'supertest'; +import * as express from 'express'; var app = express(); @@ -11,7 +11,7 @@ supertest(app) .expect('Content-Type', /json/) .expect('Content-Length', '20') .expect(201) - .end((err: any, res: supertest.Response) => { + .end((err, res) => { if (err) throw err; }); @@ -56,4 +56,3 @@ function hasPreviousAndNextKeys(res: supertest.Response) { if (!('next' in res.body)) return "missing next key"; if (!('prev' in res.body)) throw new Error("missing prev key"); } - diff --git a/supertest/supertest.d.ts b/supertest/supertest.d.ts index dccbd47c8b..9ca154e2f5 100644 --- a/supertest/supertest.d.ts +++ b/supertest/supertest.d.ts @@ -1,4 +1,4 @@ -// Type definitions for SuperTest 0.14.0 +// Type definitions for SuperTest v1.1.0 // Project: https://github.com/visionmedia/supertest // Definitions by: Alex Varju // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -8,7 +8,7 @@ declare module "supertest" { import superagent = require('superagent'); - type CallbackHandler = { (err: any, res: supertest.Response): void; }|{ (res: supertest.Response): void; }; + type CallbackHandler = (err: any, res: supertest.Response) => void; function supertest(app: any): supertest.SuperTest; @@ -29,6 +29,7 @@ declare module "supertest" { expect(field: string, val: string, callback?: CallbackHandler): Test; expect(field: string, val: RegExp, callback?: CallbackHandler): Test; expect(checker: (res: Response) => any): Test; + end(callback?: CallbackHandler): Test; } interface Response extends superagent.Response { From 612f58ac6aa92de613ed5bbb8ed7bf1c460dcec2 Mon Sep 17 00:00:00 2001 From: Lukasz Potapczuk Date: Tue, 24 Nov 2015 12:11:19 +0100 Subject: [PATCH 023/107] Added definitions for ng-stomp library --- ng-stomp/ng-stomp-test.ts | 48 +++++++++++++++++++++++++++++++++++++++ ng-stomp/ng-stomp.d.ts | 34 +++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 ng-stomp/ng-stomp-test.ts create mode 100644 ng-stomp/ng-stomp.d.ts diff --git a/ng-stomp/ng-stomp-test.ts b/ng-stomp/ng-stomp-test.ts new file mode 100644 index 0000000000..e27b1bd232 --- /dev/null +++ b/ng-stomp/ng-stomp-test.ts @@ -0,0 +1,48 @@ +/// +/// + +module ngStompTesting { + + "use strict"; + var ngStompTest = "ngStompTest"; + + class test { + constructor(private ngstomp:ngStomp) { + var connectHeaders ={ + "Lol": "user", + "Accept": "lol" + }; + + ngstomp.connect('/endpoint', connectHeaders) + + // frame = CONNECTED headers + .then(function (frame) { + + this.subscription = ngstomp.subscribe('/dest', function (payload, headers, res) { + this.payload = payload; + }, { + "headers": "are awesome" + }); + + // Unsubscribe + this.subscription.unsubscribe(); + + // Send message + ngstomp.send('/dest', { + message: 'body' + }, { + priority: 9, + custom: 42 //Custom Headers + }); + + // Disconnect + ngstomp.disconnect(function () { + + }); + }); + } + + } + + angular.module("app").controller(ngStompTest, test); +} \ No newline at end of file diff --git a/ng-stomp/ng-stomp.d.ts b/ng-stomp/ng-stomp.d.ts new file mode 100644 index 0000000000..df63974212 --- /dev/null +++ b/ng-stomp/ng-stomp.d.ts @@ -0,0 +1,34 @@ +// Type definitions for ngStomp +// Project: https://github.com/beevelop/ng-stomp +// Definitions by: Lukasz Potapczuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + + +interface ngStomp { + sock:any; + stomp:any; + debug:any; + off: any; + + setDebug:(callback:Function)=> void; + + connect: (endpoint:string, headers?:Headers)=> angular.IHttpPromise; + + disconnect: (callback:()=>void) => angular.IHttpPromise; + + subscribe: (destination:string, callback:Function, headers?:Headers, scope?:any) => any; + + unsubscribe: () => any; + + send: (destination:string, body:any, headers:Headers)=> any; + + } + + interface Headers { + [key: string]: any; + } + + + + From 4bc8a55f65b66a6855e009299287046a16ddd25b Mon Sep 17 00:00:00 2001 From: Lukasz Potapczuk Date: Tue, 24 Nov 2015 12:22:48 +0100 Subject: [PATCH 024/107] Fixed ng-stomp definitions --- ng-stomp/ng-stomp-test.ts | 3 ++- ng-stomp/ng-stomp.d.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ng-stomp/ng-stomp-test.ts b/ng-stomp/ng-stomp-test.ts index e27b1bd232..4f9092c207 100644 --- a/ng-stomp/ng-stomp-test.ts +++ b/ng-stomp/ng-stomp-test.ts @@ -9,12 +9,13 @@ module ngStompTesting { class test { constructor(private ngstomp:ngStomp) { var connectHeaders ={ - "Lol": "user", + "Auth": "user", "Accept": "lol" }; ngstomp.connect('/endpoint', connectHeaders) + // frame = CONNECTED headers .then(function (frame) { diff --git a/ng-stomp/ng-stomp.d.ts b/ng-stomp/ng-stomp.d.ts index df63974212..314f360285 100644 --- a/ng-stomp/ng-stomp.d.ts +++ b/ng-stomp/ng-stomp.d.ts @@ -17,7 +17,7 @@ interface ngStomp { disconnect: (callback:()=>void) => angular.IHttpPromise; - subscribe: (destination:string, callback:Function, headers?:Headers, scope?:any) => any; + subscribe: (destination:string, callback:(payload:string, headers:Headers, res:Function)=>void, headers?:Headers, scope?:any) => any; unsubscribe: () => any; @@ -32,3 +32,5 @@ interface ngStomp { + + From 0d29dd1f2e1ec36df21568d5f9da1263f3d099d7 Mon Sep 17 00:00:00 2001 From: Lukasz Potapczuk Date: Tue, 24 Nov 2015 12:25:28 +0100 Subject: [PATCH 025/107] Fixed ng-stomp definitions --- ng-stomp/ng-stomp.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ng-stomp/ng-stomp.d.ts b/ng-stomp/ng-stomp.d.ts index 314f360285..7cf263eeb6 100644 --- a/ng-stomp/ng-stomp.d.ts +++ b/ng-stomp/ng-stomp.d.ts @@ -1,6 +1,6 @@ // Type definitions for ngStomp // Project: https://github.com/beevelop/ng-stomp -// Definitions by: Lukasz Potapczuk +// Definitions by: Lukasz Potapczuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From ed11abd71a0d06fd37a65ee9d0908e5106b06347 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Tue, 24 Nov 2015 14:19:08 +0200 Subject: [PATCH 026/107] Removed immutable Immutable changed to any and added TODO. --- flux/flux.d.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/flux/flux.d.ts b/flux/flux.d.ts index 5b6079d50b..dc476f3bc6 100644 --- a/flux/flux.d.ts +++ b/flux/flux.d.ts @@ -3,7 +3,6 @@ // Definitions by: Steve Baker , Giedrius Grabauskas // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// /// declare module Flux { @@ -84,8 +83,8 @@ declare module FluxUtils { /** * This class extends ReduceStore and defines the state as an immutable map. */ - export class MapStore extends ReduceStore> { - + // TODO: Change to > + export class MapStore extends ReduceStore { /** * Access the value at the given key. * Throws an error if the key does not exist in the cache. @@ -108,7 +107,9 @@ declare module FluxUtils { * it allows providing a previous result to update instead of generating a new map. * Providing a previous result allows the possibility of keeping the same reference if the keys did not change. */ - getAll(keys: Immutable.IndexedIterable, prev?: Immutable.Map): Immutable.Map; + // TODO: Update with Immutable interface. + // getAll(keys: Immutable.IndexedIterable, prev?: Immutable.Map): Immutable.Map; + getAll(keys: any, prev?: any): any; } export class ReduceStore extends Store { From f9cd3e383d7462c7dfcd2eca8ff088534d270e08 Mon Sep 17 00:00:00 2001 From: mirogrenda Date: Tue, 24 Nov 2015 15:40:54 +0100 Subject: [PATCH 027/107] ckeditor: added CKEDITOR.lang type definition Added the missing CKEDITOR.lang type definition (stores language-related functions - see https://github.com/ckeditor/ckeditor-dev/blob/master/core/lang.js) --- ckeditor/ckeditor.d.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ckeditor/ckeditor.d.ts b/ckeditor/ckeditor.d.ts index 0164bb09b9..b3c2f45243 100644 --- a/ckeditor/ckeditor.d.ts +++ b/ckeditor/ckeditor.d.ts @@ -1139,4 +1139,12 @@ declare module CKEDITOR { function isTabEnabled(editor: editor, dialogName: string, tabName: string): boolean; function okButton(): void; } -} + + module lang { + var languages: any; + var rtl: any; + + function load(languageCode: string, defaultLanguage: string, callback: Function): void; + function detect(defaultLanguage: string, probeLanguage: string): string; + } +} \ No newline at end of file From 0cf0251b353eed2dc733804e51d094334138dd1a Mon Sep 17 00:00:00 2001 From: Ivan Drinchev Date: Tue, 24 Nov 2015 17:22:57 +0200 Subject: [PATCH 028/107] Added umzug v1.7.0 definitions --- umzug/umzug-tests.ts | 134 ++++++++++++++++++++++++++++++ umzug/umzug.d.ts | 188 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 322 insertions(+) create mode 100644 umzug/umzug-tests.ts create mode 100644 umzug/umzug.d.ts diff --git a/umzug/umzug-tests.ts b/umzug/umzug-tests.ts new file mode 100644 index 0000000000..95d7521fd3 --- /dev/null +++ b/umzug/umzug-tests.ts @@ -0,0 +1,134 @@ +/// +/// +/// + +import Umzug = require("umzug"); +import Sequelize = require("sequelize"); + + +var umzug = new Umzug({}); + +umzug.up().then(function (result) { + // do something with the result +}); + +umzug.execute({ + migrations: ['some-id', 'some-other-id'], + method: 'up' +}).then(function (migrations) { + // "migrations" will be an Array of all executed/reverted migrations. +}); + +umzug.pending().then(function (migrations) { + // "migrations" will be an Array with the names of + // pending migrations. +}); + +umzug.executed().then(function (migrations) { + // "migrations" will be an Array of already executed migrations. +}); + +umzug.up().then(function (migrations) { + // "migrations" will be an Array with the names of the + // executed migrations. +}); + +umzug.up({ to: '20141101203500-task' }).then(function (migrations) {}); + +umzug.up({ migrations: ['20141101203500-task', '20141101203501-task-2'] }); + +umzug.up('20141101203500-task'); // Runs just the passed migration +umzug.up(['20141101203500-task', '20141101203501-task-2']); + +umzug.down().then(function (migration) { + // "migration" will the name of the reverted migration. +}); + +umzug.down({ to: '20141031080000-task' }).then(function (migrations) { + // "migrations" will be an Array with the names of all reverted migrations. +}); + +umzug.down({ migrations: ['20141101203500-task', '20141101203501-task-2'] }); + +umzug.down('20141101203500-task'); // Runs just the passed migration +umzug.down(['20141101203500-task', '20141101203501-task-2']); + +var AnotherUmzug = new Umzug({ + // The storage. + // Possible values: 'json', 'sequelize', an object + storage: 'json', + + // The options for the storage. + // Check the available storages for further details. + storageOptions: {}, + + // The logging function. + // A function that gets executed everytime migrations start and have ended. + logging: false, + + // The name of the positive method in migrations. + upName: 'up', + + // The name of the negative method in migrations. + downName: 'down', + + migrations: { + // The params that gets passed to the migrations. + // Might be an array or a synchronous function which returns an array. + params: [], + + // The path to the migrations directory. + path: 'migrations', + + // The pattern that determines whether or not a file is a migration. + pattern: /^\d+[\w-]+\.js$/, + + // A function that receives and returns the to be executed function. + // This can be used to modify the function. + wrap: function (fun : Function) { return fun; } + } +}); + +var AnotherUmzug = new Umzug({ + // The storage. + // Possible values: 'json', 'sequelize', an object + storage: 'json', + storageOptions: { + path: process.cwd() + '/db/sequelize-meta.json' + } +}); + +var sequelize = new Sequelize(''); + +var AnotherUmzug = new Umzug({ + // The storage. + // Possible values: 'json', 'sequelize', an object + storage: 'sequelize', + storageOptions: { + // The configured instance of Sequelize. + // Optional if `model` is passed. + sequelize: sequelize, + + // The to be used Sequelize model. + // Must have column name matching `columnName` option + // Optional of `sequelize` is passed. + model: sequelize.define( 'model', {} ), + + // The name of the to be used model. + // Defaults to 'SequelizeMeta' + modelName: 'Schema', + + // The name of table to create if `model` option is not supplied + // Defaults to `modelName` + tableName: 'Schema', + + // The name of table column holding migration name. + // Defaults to 'name'. + columnName: 'migration', + + // The type of the column holding migration name. + // Defaults to `Sequelize.STRING` + columnType: Sequelize.STRING(100) + } + +}); diff --git a/umzug/umzug.d.ts b/umzug/umzug.d.ts new file mode 100644 index 0000000000..2e2b20a7c1 --- /dev/null +++ b/umzug/umzug.d.ts @@ -0,0 +1,188 @@ +// Type definitions for Umzug v1.7.0 +// Project: https://github.com/sequelize/umzug +// Definitions by: Ivan Drinchev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module "umzug" { + + import Sequelize = require("sequelize"); + + interface MigrationOptions { + + /* + * The params that gets passed to the migrations. + * Might be an array or a synchronous function which returns an array. + */ + params?: Array; + + /** The path to the migrations directory. */ + path?: string; + + /** The pattern that determines whether or not a file is a migration. */ + pattern?: RegExp; + + /** + * A function that receives and returns the to be executed function. + * This can be used to modify the function. + */ + wrap?: ( fn : T ) => T; + + } + + interface JSONStorageOptions { + + /** + * The path to the json storage. + * Defaults to process.cwd() + '/umzug.json'; + */ + path?: string; + + } + + interface SequelizeStorageOptions { + + /** + * The configured instance of Sequelize. + * Optional if `model` is passed. + */ + sequelize?: Sequelize.Sequelize; + + /** + * The to be used Sequelize model. + * Must have column name matching `columnName` option + * Optional of `sequelize` is passed. + */ + model?: Sequelize.Model; + + /** + * The name of the to be used model. + * Defaults to 'SequelizeMeta' + */ + modelName?: string; + + /** + * The name of table to create if `model` option is not supplied + * Defaults to `modelName` + */ + tableName?: string; + + /** + * The name of table column holding migration name. + * Defaults to 'name'. + */ + columnName: string; + + /** + * The type of the column holding migration name. + * Defaults to `Sequelize.STRING` + */ + columnType: Sequelize.DataTypeAbstract; + + } + + interface ExecuteOptions { + migrations?: Array; + method?: string; + } + + interface UmzugOptions { + + /** + * The storage. + * Possible values: 'json', 'sequelize', an object + */ + storage?: string; + + /** + * The options for the storage. + */ + storageOptions?: JSONStorageOptions | SequelizeStorageOptions | Object; + + /** + * The logging function. + * A function that gets executed everytime migrations start and have ended. + */ + logging? : boolean | Function; + + /** + * The name of the positive method in migrations. + */ + upName? : string; + + /** + * The name of the negative method in migrations. + */ + downName? : string; + + /** + * Options for defined migration + */ + migrations? : MigrationOptions; + + } + + interface UpDownToOptions { + + /** + * It is also possible to pass the name of a migration in order to + * just run the migrations from the current state to the passed + * migration name. + */ + to: string; + + } + + interface UpDownMigrationsOptions { + + /** + * Running specific migrations while ignoring the right order, can be + * done like this: + */ + migrations: Array; + + } + + class Umzug { + + constructor(options?: UmzugOptions); + + /** + * The execute method is a general purpose function that runs for + * every specified migrations the respective function. + */ + execute(options? : ExecuteOptions) : Promise>; + + /** + * You can get a list of pending/not yet executed migrations like this: + */ + pending() : Promise>; + + /** + * You can get a list of already executed migrations like this: + */ + executed() : Promise>; + + /** + * The up method can be used to execute all pending migrations. + */ + up(migration?: string) : Promise; + up(migrations?: Array) : Promise>; + up(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise>; + + /** + * The down method can be used to revert the last executed migration. + */ + down(migration?: string) : Promise; + down(migrations?: Array) : Promise>; + down(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise>; + + } + + var umzug : typeof Umzug; + + export = umzug; + +} From eb5d102c53dd046694b34a64e9fc1ffaa8a3797c Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 25 Nov 2015 04:47:56 +0500 Subject: [PATCH 029/107] lodash: signatures of _.flattenDeep have been changed --- lodash/lodash-tests.ts | 34 ++++++++++++++++++++++++++++------ lodash/lodash.d.ts | 18 ++++++++++++++++-- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 30c0b99344..731d12c6dc 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -615,18 +615,40 @@ module TestFlattenDeep { result = _.flattenDeep(recursiveArray); result = _.flattenDeep(listOfMaybeRecursiveArraysOrValues); - - result = _(recursiveArray).flattenDeep().value(); - - result = _(listOfMaybeRecursiveArraysOrValues).flattenDeep().value(); } { - let result: any; + let result: any[]; result = _.flattenDeep(recursiveList); + } - result = _(recursiveList).flattenDeep().value(); + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(recursiveArray).flattenDeep(); + + result = _(listOfMaybeRecursiveArraysOrValues).flattenDeep(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(recursiveList).flattenDeep(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(recursiveArray).chain().flattenDeep(); + + result = _(listOfMaybeRecursiveArraysOrValues).chain().flattenDeep(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(recursiveList).chain().flattenDeep(); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 73a783b64c..dd347d9d17 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1131,14 +1131,28 @@ declare module _ { /** * @see _.flattenDeep */ - flattenDeep(): LoDashImplicitArrayWrapper; + flattenDeep(): LoDashImplicitArrayWrapper; } interface LoDashImplicitObjectWrapper { /** * @see _.flattenDeep */ - flattenDeep(): LoDashImplicitArrayWrapper; + flattenDeep(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashExplicitArrayWrapper; } //_.head From 56fa333e5a07268f39caa2ea9717742c1af67d8e Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 02:25:09 +0200 Subject: [PATCH 030/107] Imported FluxUtils and React Imported FluxUtils and React modules and added react typescript definitions reference. --- flux/flux-tests.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/flux/flux-tests.ts b/flux/flux-tests.ts index f41d15aff1..52507a2248 100644 --- a/flux/flux-tests.ts +++ b/flux/flux-tests.ts @@ -1,6 +1,12 @@ /// +/// import flux = require('flux') +import FluxUtils = require('flux/utils') +import React = require('react') + +var Component = React.Component +var Container = FluxUtils.Container // // Basic dispatcher usage @@ -78,4 +84,6 @@ class CustomDispatcher extends flux.Dispatcher { var customDispatcher = new CustomDispatcher() -export = customDispatcher \ No newline at end of file +export = customDispatcher + + From 66f52639ef5e850bc71356852b2b5ebc8db1215d Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 02:26:37 +0200 Subject: [PATCH 031/107] Added test code --- flux/flux-tests.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/flux/flux-tests.ts b/flux/flux-tests.ts index 52507a2248..c804babd85 100644 --- a/flux/flux-tests.ts +++ b/flux/flux-tests.ts @@ -86,4 +86,41 @@ var customDispatcher = new CustomDispatcher() export = customDispatcher +// Sample Reduce Store +class CounterStore extends ReduceStore { + getInitialState(): number { + return 0; + } + reduce(state: number, action: Object): number { + switch (action.type) { + case 'increment': + return state + 1; + + case 'square': + return state * state; + + default: + return state; + } + } +} + +// Sample Flux container with CounterStore +class CounterContainer extends Component { + static getStores() { + return [CounterStore]; + } + + static calculateState(prevState) { + return { + counter: CounterStore.getState(), + }; + } + + render() { + return {this.state.counter}; + } +} + +const container = Container.create(CounterContainer); From f67ea5412d895e5e56db4e2c3e909363b50c6ef4 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 02:33:58 +0200 Subject: [PATCH 032/107] Removed JSX elements. --- flux/flux-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flux/flux-tests.ts b/flux/flux-tests.ts index c804babd85..33225178a5 100644 --- a/flux/flux-tests.ts +++ b/flux/flux-tests.ts @@ -119,7 +119,7 @@ class CounterContainer extends Component { } render() { - return {this.state.counter}; + return this.state.counter; } } From 5eb0edcee2c0015fc546a0ba79204abc898fddc5 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 02:40:50 +0200 Subject: [PATCH 033/107] Fixed test errors --- flux/flux-tests.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/flux/flux-tests.ts b/flux/flux-tests.ts index 33225178a5..9f583475ef 100644 --- a/flux/flux-tests.ts +++ b/flux/flux-tests.ts @@ -7,6 +7,7 @@ import React = require('react') var Component = React.Component var Container = FluxUtils.Container +var ReduceStore = FluxUtils.ReduceStore // // Basic dispatcher usage @@ -92,7 +93,7 @@ class CounterStore extends ReduceStore { return 0; } - reduce(state: number, action: Object): number { + reduce(state: number, action: any): number { switch (action.type) { case 'increment': return state + 1; @@ -107,12 +108,12 @@ class CounterStore extends ReduceStore { } // Sample Flux container with CounterStore -class CounterContainer extends Component { +class CounterContainer extends Component { static getStores() { return [CounterStore]; } - static calculateState(prevState) { + static calculateState(prevState: any) { return { counter: CounterStore.getState(), }; From b8ce2921dce286372842e2c5efe731513e5bc452 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 02:45:53 +0200 Subject: [PATCH 034/107] ReduceStore import updated and changed extends. --- flux/flux-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flux/flux-tests.ts b/flux/flux-tests.ts index 9f583475ef..0fe6e13d1a 100644 --- a/flux/flux-tests.ts +++ b/flux/flux-tests.ts @@ -7,7 +7,6 @@ import React = require('react') var Component = React.Component var Container = FluxUtils.Container -var ReduceStore = FluxUtils.ReduceStore // // Basic dispatcher usage @@ -87,8 +86,9 @@ var customDispatcher = new CustomDispatcher() export = customDispatcher + // Sample Reduce Store -class CounterStore extends ReduceStore { +class CounterStore extends FluxUtils.ReduceStore { getInitialState(): number { return 0; } From 3f99edd466ce2039ccdf9088e6b0d578c920df62 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 02:49:06 +0200 Subject: [PATCH 035/107] Object changed to any. --- flux/flux.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/flux/flux.d.ts b/flux/flux.d.ts index dc476f3bc6..c65892321c 100644 --- a/flux/flux.d.ts +++ b/flux/flux.d.ts @@ -77,7 +77,7 @@ declare module FluxUtils { * that updates its state when relevant stores change. * The provided base class must have static methods getStores() and calculateState(). */ - static create(base: React.ComponentClass, options?: Object): React.ComponentClass; + static create(base: React.ComponentClass, options?: any): React.ComponentClass; } /** @@ -130,7 +130,7 @@ declare module FluxUtils { * All subclasses must implement this method. * This method should be pure and have no side-effects. */ - reduce(state: T, action: Object): T; + reduce(state: T, action: any): T; /** * Checks if two versions of state are the same. @@ -145,7 +145,7 @@ declare module FluxUtils { /** * Constructs and registers an instance of this store with the given dispatcher. */ - constructor(dispatcher: Flux.Dispatcher); + constructor(dispatcher: Flux.Dispatcher); /** * Adds a listener to the store, when the store changes the given callback will be called. @@ -157,7 +157,7 @@ declare module FluxUtils { /** * Returns the dispatcher this store is registered with. */ - getDispatcher(): Flux.Dispatcher; + getDispatcher(): Flux.Dispatcher; /** * Returns the dispatch token that the dispatcher recognizes this store by. @@ -184,7 +184,7 @@ declare module FluxUtils { * This is how the store receives actions from the dispatcher. * All state mutation logic must be done during this method. */ - __onDispatch(payload: Object): void; + __onDispatch(payload: any): void; } } From 01f5b8f246217b8fdf44131b74eb78284f84b35c Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 03:00:46 +0200 Subject: [PATCH 036/107] Store called and moved to cosnt. --- flux/flux-tests.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/flux/flux-tests.ts b/flux/flux-tests.ts index 0fe6e13d1a..4c83c8e1c3 100644 --- a/flux/flux-tests.ts +++ b/flux/flux-tests.ts @@ -107,15 +107,18 @@ class CounterStore extends FluxUtils.ReduceStore { } } +var Disaptcher: any; +const Store = new CounterStore(Dispatcher); + // Sample Flux container with CounterStore class CounterContainer extends Component { static getStores() { - return [CounterStore]; + return [Store]; } static calculateState(prevState: any) { return { - counter: CounterStore.getState(), + counter: Store.getState(), }; } From 3201084d33a46cdc09aadee5ea2085f8010fae70 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 03:02:37 +0200 Subject: [PATCH 037/107] Fixed mistype --- flux/flux-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flux/flux-tests.ts b/flux/flux-tests.ts index 4c83c8e1c3..d4f4f5510e 100644 --- a/flux/flux-tests.ts +++ b/flux/flux-tests.ts @@ -108,7 +108,7 @@ class CounterStore extends FluxUtils.ReduceStore { } var Disaptcher: any; -const Store = new CounterStore(Dispatcher); +const Store = new CounterStore(Disaptcher); // Sample Flux container with CounterStore class CounterContainer extends Component { From 06911fd64b6f30fff878c1f2f240c4e304644a7e Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Wed, 25 Nov 2015 03:08:28 +0200 Subject: [PATCH 038/107] Changed to use basicDispatcher in Store. --- flux/flux-tests.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/flux/flux-tests.ts b/flux/flux-tests.ts index d4f4f5510e..24369ef2dd 100644 --- a/flux/flux-tests.ts +++ b/flux/flux-tests.ts @@ -107,8 +107,7 @@ class CounterStore extends FluxUtils.ReduceStore { } } -var Disaptcher: any; -const Store = new CounterStore(Disaptcher); +const Store = new CounterStore(basicDispatcher); // Sample Flux container with CounterStore class CounterContainer extends Component { From ba1ba6fdeb2d2c17b153589f9374fedba54cfa3e Mon Sep 17 00:00:00 2001 From: Andrew Fong Date: Wed, 25 Nov 2015 02:05:27 +0000 Subject: [PATCH 039/107] Individual chart options may also override global options --- chartjs/chart-tests.ts | 31 ++++++++++++++- chartjs/chart.d.ts | 88 +++++++++++++++++++++--------------------- 2 files changed, 74 insertions(+), 45 deletions(-) diff --git a/chartjs/chart-tests.ts b/chartjs/chart-tests.ts index 4bd8820c6c..452ddbf623 100644 --- a/chartjs/chart-tests.ts +++ b/chartjs/chart-tests.ts @@ -325,7 +325,7 @@ var myDoughnutChart = new Chart(ctx).Doughnut(pieData, { animateRotate: true, animateScale: false, legendTemplate: "
    -legend\"><% for (var i=0; i
  • \"><%if(segments[i].label){%><%=segments[i].label%><%}%>
  • <%}%>
" -}); +}); var myDoughnutChartLegend: string = myDoughnutChart.generateLegend(); var myDoughnutChartImage: string = myDoughnutChart.toBase64Image(); @@ -341,3 +341,32 @@ myDoughnutChart.resize(); myDoughnutChart.update(); myDoughnutChart.stop(); myDoughnutChart.destroy(); + +// Test using charts with overrides of a subset of global options +var partialOpts: ChartSettings = { + showTooltips: true, + tooltipEvents: ["mousemove", "touchstart", "touchmove"], + tooltipFillColor: "rgba(0,0,0,0.8)", + tooltipFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif", + tooltipFontSize: 14, + tooltipFontStyle: "normal", + tooltipFontColor: "#fff", + tooltipTitleFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif", + tooltipTitleFontSize: 14, + tooltipTitleFontStyle: "bold", + tooltipTitleFontColor: "#fff", + tooltipYPadding: 6, + tooltipXPadding: 6, + tooltipCaretSize: 8, + tooltipCornerRadius: 6, + tooltipXOffset: 10, + tooltipTemplate: "<%if (label){%><%=label%>: <%}%><%= value %>" +}; + +var my2ndLineChart = new Chart(ctx).Line(lineData, partialOpts); +var my2ndBarChart = new Chart(ctx).Bar(barData, partialOpts); +var my2ndRadarChart = new Chart(ctx).Radar(radarData, partialOpts); +var my2ndPolarAreaChart = new Chart(ctx).PolarArea(polarAreaData, partialOpts); +var my2ndPieChart = new Chart(ctx).Pie(pieData, partialOpts); +var my2ndDoughnutChart = new Chart(ctx).Doughnut(pieData, partialOpts); + diff --git a/chartjs/chart.d.ts b/chartjs/chart.d.ts index d337d144a6..62f393b8a1 100644 --- a/chartjs/chart.d.ts +++ b/chartjs/chart.d.ts @@ -33,49 +33,49 @@ interface CircularChartData { } interface ChartSettings { - animation: boolean; - animationSteps: number; - animationEasing: string; - showScale: boolean; - scaleOverride: boolean; - scaleSteps: number; - scaleStepWidth: number; - scaleStartValue: number; - scaleLineColor: string; - scaleLineWidth: number; - scaleShowLabels: boolean; - scaleLabel: string; - scaleIntegersOnly: boolean; - scaleBeginAtZero: boolean; - scaleFontFamily: string; - scaleFontSize: number; - scaleFontStyle: string; - scaleFontColor: string; - responsive: boolean; - maintainAspectRatio: boolean; - showTooltips: boolean; - tooltipEvents: string[]; - tooltipFillColor: string; - tooltipFontFamily: string; - tooltipFontSize: number; - tooltipFontStyle: string; - tooltipFontColor: string; - tooltipTitleFontFamily: string; - tooltipTitleFontSize: number; - tooltipTitleFontStyle: string; - tooltipTitleFontColor: string; - tooltipYPadding: number; - tooltipXPadding: number; - tooltipCaretSize: number; - tooltipCornerRadius: number; - tooltipXOffset: number; - tooltipTemplate: string; - multiTooltipTemplate: string; - onAnimationProgress: () => any; - onAnimationComplete: () => any; + animation?: boolean; + animationSteps?: number; + animationEasing?: string; + showScale?: boolean; + scaleOverride?: boolean; + scaleSteps?: number; + scaleStepWidth?: number; + scaleStartValue?: number; + scaleLineColor?: string; + scaleLineWidth?: number; + scaleShowLabels?: boolean; + scaleLabel?: string; + scaleIntegersOnly?: boolean; + scaleBeginAtZero?: boolean; + scaleFontFamily?: string; + scaleFontSize?: number; + scaleFontStyle?: string; + scaleFontColor?: string; + responsive?: boolean; + maintainAspectRatio?: boolean; + showTooltips?: boolean; + tooltipEvents?: string[]; + tooltipFillColor?: string; + tooltipFontFamily?: string; + tooltipFontSize?: number; + tooltipFontStyle?: string; + tooltipFontColor?: string; + tooltipTitleFontFamily?: string; + tooltipTitleFontSize?: number; + tooltipTitleFontStyle?: string; + tooltipTitleFontColor?: string; + tooltipYPadding?: number; + tooltipXPadding?: number; + tooltipCaretSize?: number; + tooltipCornerRadius?: number; + tooltipXOffset?: number; + tooltipTemplate?: string; + multiTooltipTemplate?: string; + onAnimationProgress?: () => any; + onAnimationComplete?: () => any; } -interface ChartOptions { +interface ChartOptions extends ChartSettings { scaleShowGridLines?: boolean; scaleGridLineColor?: string; scaleGridLineWidth?: number; @@ -138,7 +138,7 @@ interface BarChartOptions extends ChartOptions { barDatasetSpacing?: number; } -interface RadarChartOptions { +interface RadarChartOptions extends ChartSettings { scaleShowLine?: boolean; angleShowLineOut?: boolean; scaleShowLabels?: boolean; @@ -159,7 +159,7 @@ interface RadarChartOptions { legendTemplate?: string; } -interface PolarAreaChartOptions { +interface PolarAreaChartOptions extends ChartSettings { scaleShowLabelBackdrop?: boolean; scaleBackdropColor?: string; scaleBeginAtZero?: boolean; @@ -176,7 +176,7 @@ interface PolarAreaChartOptions { legendTemplate?: string; } -interface PieChartOptions { +interface PieChartOptions extends ChartSettings { segmentShowStroke?: boolean; segmentStrokeColor?: string; segmentStrokeWidth?: number; From dcefa9ec84b7fb0ae4776310cf21e7d019b5a9de Mon Sep 17 00:00:00 2001 From: Mehrdad Reshadi Date: Tue, 24 Nov 2015 21:21:11 -0800 Subject: [PATCH 040/107] added missing types for jakejs --- jake/jake.d.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/jake/jake.d.ts b/jake/jake.d.ts index 1812b818b7..95614374cc 100644 --- a/jake/jake.d.ts +++ b/jake/jake.d.ts @@ -40,6 +40,16 @@ declare function fail(...err:any[]): void; */ declare function file(name:string, prereqs?:string[], action?:()=>void, opts?:jake.FileTaskOptions): jake.FileTask; +/** + * Creates Jake FileTask from regex patterns + * @name name/pattern of the Task + * @param source calculated from the name pattern + * @param prereqs Prerequisites to be run before this task + * @param action The action to perform for this task + * @param opts Perform this task asynchronously. If you flag a task with this option, you must call the global `complete` method inside the task's action, for execution to proceed to the next task. + */ +declare function rule(pattern: RegExp, source: string | { (name: string): string; }, prereqs?: string[], action?: () => void, opts?: jake.TaskOptions): void; + /** * Creates a namespace which allows logical grouping of tasks, and prevents name-collisions with task-names. Namespaces can be nested inside of other namespaces. * @param name The name of the namespace @@ -185,6 +195,11 @@ declare module jake{ * @default false */ async?: boolean; + + /** + * number of parllel async tasks + */ + parallelLimit?: number; } /** From 4b6d9d687d59b7099efa50b8b128b91581981b8e Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Wed, 25 Nov 2015 11:07:18 +0200 Subject: [PATCH 041/107] Simplify scripts in package.json npm already puts the directory in question in PATH --- package.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 2b9d019f80..f20ff96cf7 100644 --- a/package.json +++ b/package.json @@ -20,17 +20,17 @@ "node": ">= 0.12.0" }, "scripts": { - "test": "./node_modules/.bin/dt --changes", - "changes": "./node_modules/.bin/dt --changes", - "lint": "./node_modules/.bin/dt --lint", - "tscparams": "./node_modules/.bin/dt --tscparams --no-tests --no-headers", - "all": "./node_modules/.bin/dt", - "dry": "./node_modules/.bin/dt --dry --changes", - "list": "./node_modules/.bin/dt --dry --print-files --print-refmap", - "last": "./node_modules/.bin/dt --dry --print-files --print-refmap --changes", - "files": "./node_modules/.bin/dt --dry --print-files", - "refmap": "./node_modules/.bin/dt --dry --print-refmap", - "help": "./node_modules/.bin/dt -h" + "test": "dt --changes", + "changes": "dt --changes", + "lint": "dt --lint", + "tscparams": "dt --tscparams --no-tests --no-headers", + "all": "dt", + "dry": "dt --dry --changes", + "list": "dt --dry --print-files --print-refmap", + "last": "dt --dry --print-files --print-refmap --changes", + "files": "dt --dry --print-files", + "refmap": "dt --dry --print-refmap", + "help": "dt -h" }, "dependencies": { }, From 53e93bf70a34ea14ca718a82bc68dec7386e081a Mon Sep 17 00:00:00 2001 From: "Remo H. Jansen" Date: Wed, 25 Nov 2015 09:40:03 +0000 Subject: [PATCH 042/107] Added Q.race method. This method was missing from the type definitions file. --- q/Q.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/q/Q.d.ts b/q/Q.d.ts index 50ee49c52a..ba30b2745a 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -206,6 +206,11 @@ declare module Q { * Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected. */ export function all(promises: IPromise[]): Promise; + + /** + * Returns a promise for the first of an array of promises to become settled. + */ + export function race(promises: IPromise[]): Promise; /** * Returns a promise that is fulfilled with an array of promise state snapshots, but only after all the original promises have settled, i.e. become either fulfilled or rejected. From 84a38034f75c85cd3951e94c0165b360ad8680ae Mon Sep 17 00:00:00 2001 From: Jan Vorwerk Date: Wed, 25 Nov 2015 11:46:30 +0100 Subject: [PATCH 043/107] add empty namespace declaration for gulp-uglify to allow es6 imports (see /Microsoft/TypeScript/issues/5073) --- gulp-uglify/gulp-uglify.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gulp-uglify/gulp-uglify.d.ts b/gulp-uglify/gulp-uglify.d.ts index 840b5110bd..05eb937ed3 100644 --- a/gulp-uglify/gulp-uglify.d.ts +++ b/gulp-uglify/gulp-uglify.d.ts @@ -170,6 +170,6 @@ declare module "gulp-uglify" { */ comments_before: string[]; } - + namespace GulpUglify {} export = GulpUglify; -} \ No newline at end of file +} From c6820e3980f977031e2ed05456ab3f0eb0bffbe9 Mon Sep 17 00:00:00 2001 From: Paldom Date: Wed, 25 Nov 2015 13:35:58 +0100 Subject: [PATCH 044/107] expiresInMinutes is deprecated, use expiresIn instead --- jsonwebtoken/jsonwebtoken.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jsonwebtoken/jsonwebtoken.d.ts b/jsonwebtoken/jsonwebtoken.d.ts index 205970f6a1..bb74aa8538 100644 --- a/jsonwebtoken/jsonwebtoken.d.ts +++ b/jsonwebtoken/jsonwebtoken.d.ts @@ -22,8 +22,13 @@ declare module "jsonwebtoken" { * - none: No digital signature or MAC value included */ algorithm?: string; - /** @member {number} - Lifetime for the token in minutes */ + /** + *@deprecated - see expiresIn + *@member {number} - Lifetime for the token in minutes + */ expiresInMinutes?: number; + /** @member {string} - Lifetime for the token expressed in a string describing a time span [rauchg/ms](https://github.com/rauchg/ms.js). Eg: `60`, `"2 days"`, `"10h"`, `"7d"` */ + expiresIn?: string; audience?: string; subject?: string; issuer?: string; @@ -33,6 +38,7 @@ declare module "jsonwebtoken" { export interface VerifyOptions { audience?: string; issuer?: string; + maxAge?: string; } export interface VerifyCallbak { From 1000b2c823ef215653d60d0a2f66dd9b4c38f183 Mon Sep 17 00:00:00 2001 From: dencap Date: Wed, 25 Nov 2015 17:18:44 +0100 Subject: [PATCH 045/107] First draft of definition for pako --- pako/pako-tests.ts | 26 ++++++++++++++++++++ pako/pako.d.ts | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 pako/pako-tests.ts create mode 100644 pako/pako.d.ts diff --git a/pako/pako-tests.ts b/pako/pako-tests.ts new file mode 100644 index 0000000000..b7bb504caf --- /dev/null +++ b/pako/pako-tests.ts @@ -0,0 +1,26 @@ +/// + +import pako = require("pako"); + +var test = { my: 'super', puper: [456, 567], awesome: 'pako' }; + +var binaryString = pako.deflate(JSON.stringify(test), { to: 'string' }); + +// +// Here you can do base64 encode, make xhr requests and so on. +// + +var restored = JSON.parse(pako.inflate(binaryString, { to: 'string' })); + +var pako = require('pako') + , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) + , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); + +var deflate = new pako.Deflate({ level: 3}); + +deflate.push(chunk1, false); +deflate.push(chunk2, true); // true -> last chunk + +if (deflate.err) { throw new Error(deflate.err); } + +console.log(deflate.result); \ No newline at end of file diff --git a/pako/pako.d.ts b/pako/pako.d.ts new file mode 100644 index 0000000000..42465cee1a --- /dev/null +++ b/pako/pako.d.ts @@ -0,0 +1,60 @@ +// Type definitions for pako 0.2.8 +// Project: https://github.com/nodeca/pako +// Definitions by: Denis Cappellin +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module Pako { + + /** + * Compress data with deflate algorithm and options. + */ + export function deflate( data: Uint8Array | Array | string, options?: any ): string; + /** + * The same as deflate, but creates raw data, without wrapper (header and adler32 crc). + */ + export function deflateRaw( data: Uint8Array | Array | string, options?: any ): string; + /** + * The same as deflate, but create gzip wrapper instead of deflate one. + */ + export function gzip( data: Uint8Array | Array | string, options?: any ): string; + /** + * Decompress data with inflate/ungzip and options. Autodetect format via wrapper header + * by default. That's why we don't provide separate ungzip method. + */ + export function inflate( data: Uint8Array | Array | string, options?: any ): Uint8Array | Array | string; + /** + * The same as inflate, but creates raw data, without wrapper (header and adler32 crc). + */ + export function inflateRaw( data: Uint8Array | Array | string, options?: any ): Uint8Array | Array | string; + /** + * Just shortcut to inflate, because it autodetects format by header.content. Done for convenience. + */ + export function ungzip( data: Uint8Array | Array | string, options?: any ): Uint8Array | Array | string; + + export interface Deflate { + /** + * + */ + constructor( options?: any ); + err: number; + msg: string; + result: Uint8Array | Array; + onData( chunk: Uint8Array | Array | string ): void; + onEnd( status: number ): void; + push( data: Uint8Array | Array | ArrayBuffer | string, mode?: number | boolean ): boolean; + } + + export interface Inflate { + constructor( options?: any ); + err: number; + msg: string; + result: Uint8Array | Array | string; + onData( chunk: Uint8Array | Array | string ): void; + onEnd( status: number ): void; + push( data: Uint8Array | Array | ArrayBuffer | string, mode?: number | boolean ): boolean; + } +} + +declare module 'pako' { + export = Pako; +} From 82a3b88cdcf3d7832537020c33a30a1d90462e54 Mon Sep 17 00:00:00 2001 From: dencap Date: Wed, 25 Nov 2015 17:23:03 +0100 Subject: [PATCH 046/107] First draft of definition for pako --- pako/pako-tests.ts | 19 +++++-------------- pako/pako.d.ts | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/pako/pako-tests.ts b/pako/pako-tests.ts index b7bb504caf..b364d971ff 100644 --- a/pako/pako-tests.ts +++ b/pako/pako-tests.ts @@ -2,25 +2,16 @@ import pako = require("pako"); -var test = { my: 'super', puper: [456, 567], awesome: 'pako' }; - -var binaryString = pako.deflate(JSON.stringify(test), { to: 'string' }); - -// -// Here you can do base64 encode, make xhr requests and so on. -// - -var restored = JSON.parse(pako.inflate(binaryString, { to: 'string' })); - -var pako = require('pako') - , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) - , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); +var chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9]) +var chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]); var deflate = new pako.Deflate({ level: 3}); deflate.push(chunk1, false); deflate.push(chunk2, true); // true -> last chunk -if (deflate.err) { throw new Error(deflate.err); } +if (deflate.err) { + throw new Error( deflate.err.toString() ); +} console.log(deflate.result); \ No newline at end of file diff --git a/pako/pako.d.ts b/pako/pako.d.ts index 42465cee1a..1b86f81fa9 100644 --- a/pako/pako.d.ts +++ b/pako/pako.d.ts @@ -21,20 +21,23 @@ declare module Pako { * Decompress data with inflate/ungzip and options. Autodetect format via wrapper header * by default. That's why we don't provide separate ungzip method. */ - export function inflate( data: Uint8Array | Array | string, options?: any ): Uint8Array | Array | string; + export function inflate( data: Uint8Array | Array | string, options?: any ): Uint8Array; + export function inflate( data: Uint8Array | Array | string, options?: any ): Array; + export function inflate( data: Uint8Array | Array | string, options?: any ): String; /** * The same as inflate, but creates raw data, without wrapper (header and adler32 crc). */ - export function inflateRaw( data: Uint8Array | Array | string, options?: any ): Uint8Array | Array | string; + export function inflateRaw( data: Uint8Array | Array | string, options?: any ): Uint8Array; + export function inflateRaw( data: Uint8Array | Array | string, options?: any ): Array; + export function inflateRaw( data: Uint8Array | Array | string, options?: any ): string; /** * Just shortcut to inflate, because it autodetects format by header.content. Done for convenience. */ - export function ungzip( data: Uint8Array | Array | string, options?: any ): Uint8Array | Array | string; + export function ungzip( data: Uint8Array | Array | string, options?: any ): Uint8Array; + export function ungzip( data: Uint8Array | Array | string, options?: any ): Array; + export function ungzip( data: Uint8Array | Array | string, options?: any ): string; - export interface Deflate { - /** - * - */ + export class Deflate { constructor( options?: any ); err: number; msg: string; @@ -44,7 +47,7 @@ declare module Pako { push( data: Uint8Array | Array | ArrayBuffer | string, mode?: number | boolean ): boolean; } - export interface Inflate { + export class Inflate { constructor( options?: any ); err: number; msg: string; From b65f3c4365af162392297de198ed5b8708413c17 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Wed, 25 Nov 2015 17:52:21 +0100 Subject: [PATCH 047/107] handleUpgrades option support in ServerOptions interface http://restify.com/#creating-a-server In restify docs createServer method supports handleUpgrades parameter in ServerOptions object, but it's not present in the type's interface. --- restify/restify.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/restify/restify.d.ts b/restify/restify.d.ts index 596637f23c..d3e5e35f83 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -110,6 +110,7 @@ declare module "restify" { version ?: string; responseTimeHeader ?: string; responseTimeFormatter ?: (durationInMilliseconds: number) => any; + handleUpgrades ?: boolean; } interface ClientOptions { From 6f002a7c320350182886b2b88845d5aa6875cf30 Mon Sep 17 00:00:00 2001 From: Jacques Kang Date: Wed, 25 Nov 2015 21:20:58 +0100 Subject: [PATCH 048/107] Add IonicPopupConfirmPromise confirm(options) Show a simple confirm popup with a Cancel and OK button. Resolves the promise with true if the user presses the OK button, and false if the user presses the Cancel button. (Ref: http://ionicframework.com/docs/api/service/$ionicPopup/) --- ionic/ionic.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ionic/ionic.d.ts b/ionic/ionic.d.ts index 688a253edd..3014d25a8d 100644 --- a/ionic/ionic.d.ts +++ b/ionic/ionic.d.ts @@ -246,10 +246,13 @@ declare module ionic { interface IonicPopupService { show(options: IonicPopupFullOptions): IonicPopupPromise; alert(options: IonicPopupAlertOptions): IonicPopupPromise; - confirm(options: IonicPopupConfirmOptions): IonicPopupPromise; + confirm(options: IonicPopupConfirmOptions): IonicPopupConfirmPromise; prompt(options: IonicPopupPromptOptions): IonicPopupPromise; } + interface IonicPopupConfirmPromise extends ng.IPromise { + close(value?: boolean): void; + } interface IonicPopupPromise extends ng.IPromise { close(value?: any): any; } From c000d73be493f203342c3a6d699fc5702a248272 Mon Sep 17 00:00:00 2001 From: Jacques Kang Date: Wed, 25 Nov 2015 21:24:39 +0100 Subject: [PATCH 049/107] Update test for $ionicPopup.confirm() --- ionic/ionic-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ionic/ionic-tests.ts b/ionic/ionic-tests.ts index ee8647b08c..cfb8825303 100644 --- a/ionic/ionic-tests.ts +++ b/ionic/ionic-tests.ts @@ -249,7 +249,7 @@ class IonicTestController { okType: "okType", cancelText: "Cancel", cancelType: "cancelType" - }).then(() => console.log("popover shown")) + }).then((result) => console.log(result === true ? "confirmed": "cancelled")) this.$ionicPopup.confirm({ title: "title", subTitle: "subTitle", From afe705f34bcd5367135bd2506999a1b22165b3a8 Mon Sep 17 00:00:00 2001 From: Joe Skeen Date: Wed, 25 Nov 2015 13:38:11 -0700 Subject: [PATCH 050/107] adm-zip: Move AdmZip class out of global scope; add tests --- adm-zip/adm-zip-tests.ts | 28 ++++++- adm-zip/adm-zip.d.ts | 163 +++++++++++++++++++-------------------- 2 files changed, 107 insertions(+), 84 deletions(-) diff --git a/adm-zip/adm-zip-tests.ts b/adm-zip/adm-zip-tests.ts index f8583ae617..c1e62e7f2a 100644 --- a/adm-zip/adm-zip-tests.ts +++ b/adm-zip/adm-zip-tests.ts @@ -1,10 +1,9 @@ /// import AdmZip = require("adm-zip"); - // reading archives var zip = new AdmZip("./my_file.zip"); -var zipEntries = zip.getEntries(); // an array of ZipEntry records +var zipEntries: AdmZip.IZipEntry[] = zip.getEntries(); // an array of ZipEntry records zipEntries.forEach(function (zipEntry) { console.log(zipEntry.toString()); // outputs zip entries information @@ -31,3 +30,28 @@ zip.addLocalFile("/home/me/some_picture.png"); var willSendthis = zip.toBuffer(); // or write everything to disk zip.writeZip(/*target file name*/"/home/me/files.zip"); + +function processZipEntry(zipEntry: AdmZip.IZipEntry) { + console.log('comment', zipEntry.comment); +} + +//tests taken from examples at https://github.com/cthackers/adm-zip/wiki/ADM-ZIP +import Zip = require("adm-zip"); +// loads and parses existing zip file local_file.zip +var zip = new Zip("local_file.zip"); +// creates new in memory zip +zip = new Zip(); +// loads and parses existing zip file local_file.zip +zip = new Zip("local_file.zip"); +// get all entries and iterate them +zip.getEntries().forEach((entry) => { + var entryName = entry.entryName; + var decompressedData = zip.readFile(entry); // decompressed buffer of the entry + console.log(zip.readAsText(entry)); // outputs the decompressed content of the entry +}); + +// will extract the file myfile.txt from the archive to /home/user/folder/subfolder/myfile.txt +zip.extractEntryTo("folder/subfolder/myfile.txt", "/home/user/", true, true); + +// will extract the file myfile.txt from the archive to /home/user/myfile.txt +zip.extractEntryTo("folder/subfolder/myfile.txt", "/home/user/", false, true); diff --git a/adm-zip/adm-zip.d.ts b/adm-zip/adm-zip.d.ts index 9f2eb7dfdb..ee57569dac 100644 --- a/adm-zip/adm-zip.d.ts +++ b/adm-zip/adm-zip.d.ts @@ -5,8 +5,8 @@ /// -declare module AdmZip { - class ZipFile { +declare module "adm-zip" { + class AdmZip { /** * Create a new, empty archive. */ @@ -28,7 +28,7 @@ declare module AdmZip { * @param entry ZipEntry object * @return Buffer or Null in case of error */ - readFile(entry: IZipEntry): Buffer; + readFile(entry: AdmZip.IZipEntry): Buffer; /** * Asynchronous readFile * @param entry String with the full path of the entry @@ -41,7 +41,7 @@ declare module AdmZip { * @param callback Called with a Buffer or Null in case of error * @return Buffer or Null in case of error */ - readFileAsync(entry: IZipEntry, callback: (data: Buffer, err: string) => any): void; + readFileAsync(entry: AdmZip.IZipEntry, callback: (data: Buffer, err: string) => any): void; /** * Extracts the given entry from the archive and returns the content as * plain text in the given encoding @@ -57,7 +57,7 @@ declare module AdmZip { * @param encoding Optional. If no encoding is specified utf8 is used * @return String */ - readAsText(fileName: IZipEntry, encoding?: string): string; + readAsText(fileName: AdmZip.IZipEntry, encoding?: string): string; /** * Asynchronous readAsText * @param entry String with the full path of the entry @@ -71,7 +71,7 @@ declare module AdmZip { * @param callback Called with the resulting string. * @param encoding Optional. If no encoding is specified utf8 is used */ - readAsTextAsync(fileName: IZipEntry, callback: (data: string) => any, encoding?: string): void; + readAsTextAsync(fileName: AdmZip.IZipEntry, callback: (data: string) => any, encoding?: string): void; /** * Remove the entry from the file or the entry and all its nested directories * and files if the given entry is a directory @@ -83,7 +83,7 @@ declare module AdmZip { * and files if the given entry is a directory * @param entry A ZipEntry object. */ - deleteFile(entry: IZipEntry): void; + deleteFile(entry: AdmZip.IZipEntry): void; /** * Adds a comment to the zip. The zip must be rewritten after * adding the comment. @@ -110,7 +110,7 @@ declare module AdmZip { * @param entry ZipEntry object. * @param comment The comment to add to the entry. */ - addZipEntryComment(entry: IZipEntry, comment: string): void; + addZipEntryComment(entry: AdmZip.IZipEntry, comment: string): void; /** * Returns the comment of the specified entry. * @param entry String with the full path of the entry. @@ -122,7 +122,7 @@ declare module AdmZip { * @param entry ZipEntry object. * @return String The comment of the specified entry. */ - getZipEntryComment(entry: IZipEntry): string; + getZipEntryComment(entry: AdmZip.IZipEntry): string; /** * Updates the content of an existing entry inside the archive. The zip * must be rewritten after updating the content @@ -136,7 +136,7 @@ declare module AdmZip { * @param entry ZipEntry object. * @param content The entry's new contents. */ - updateFile(entry: IZipEntry, content: Buffer): void; + updateFile(entry: AdmZip.IZipEntry, content: Buffer): void; /** * Adds a file from the disk to the archive. * @param localPath Path to a file on disk. @@ -167,14 +167,14 @@ declare module AdmZip { * Returns an array of ZipEntry objects representing the files and folders * inside the archive */ - getEntries(): IZipEntry[]; + getEntries(): AdmZip.IZipEntry[]; /** * Returns a ZipEntry object representing the file or folder specified by * ``name``. * @param name Name of the file or folder to retrieve. * @return ZipEntry The entry corresponding to the name. */ - getEntry(name: string): IZipEntry; + getEntry(name: string): AdmZip.IZipEntry; /** * Extracts the given entry to the given targetPath. * If the entry is a directory inside the archive, the entire directory and @@ -203,7 +203,7 @@ declare module AdmZip { * will be overwriten if this is true. Default is FALSE * @return Boolean */ - extractEntryTo(entryPath: IZipEntry, targetPath: string, maintainEntryPath?: boolean, overwrite?: boolean): boolean; + extractEntryTo(entryPath: AdmZip.IZipEntry, targetPath: string, maintainEntryPath?: boolean, overwrite?: boolean): boolean; /** * Extracts the entire archive to the given location * @param targetPath Target location @@ -225,76 +225,75 @@ declare module AdmZip { toBuffer(): Buffer; } - /** - * The ZipEntry is more than a structure representing the entry inside the - * zip file. Beside the normal attributes and headers a entry can have, the - * class contains a reference to the part of the file where the compressed - * data resides and decompresses it when requested. It also compresses the - * data and creates the headers required to write in the zip file. - */ - interface IZipEntry { + module AdmZip { /** - * Represents the full name and path of the file - */ - entryName: string; - rawEntryName: Buffer; - /** - * Extra data associated with this entry. - */ - extra: Buffer; - /** - * Entry comment. - */ - comment: string; - name: string; - /** - * Read-Only property that indicates the type of the entry. - */ - isDirectory: boolean; - /** - * Get the header associated with this ZipEntry. - */ - header: Buffer; - /** - * Retrieve the compressed data for this entry. Note that this may trigger - * compression if any properties were modified. - */ - getCompressedData(): Buffer; - /** - * Asynchronously retrieve the compressed data for this entry. Note that - * this may trigger compression if any properties were modified. - */ - getCompressedDataAsync(callback: (data: Buffer) => void): void; - /** - * Set the (uncompressed) data to be associated with this entry. - */ - setData(value: string): void; - /** - * Set the (uncompressed) data to be associated with this entry. - */ - setData(value: Buffer): void; - /** - * Get the decompressed data associated with this entry. - */ - getData(): Buffer; - /** - * Asynchronously get the decompressed data associated with this entry. - */ - getDataAsync(callback: (data: Buffer) => void): void; - /** - * Returns the CEN Entry Header to be written to the output zip file, plus - * the extra data and the entry comment. - */ - packHeader(): Buffer; - /** - * Returns a nicely formatted string with the most important properties of - * the ZipEntry. - */ - toString(): string; + * The ZipEntry is more than a structure representing the entry inside the + * zip file. Beside the normal attributes and headers a entry can have, the + * class contains a reference to the part of the file where the compressed + * data resides and decompresses it when requested. It also compresses the + * data and creates the headers required to write in the zip file. + */ + interface IZipEntry { + /** + * Represents the full name and path of the file + */ + entryName: string; + rawEntryName: Buffer; + /** + * Extra data associated with this entry. + */ + extra: Buffer; + /** + * Entry comment. + */ + comment: string; + name: string; + /** + * Read-Only property that indicates the type of the entry. + */ + isDirectory: boolean; + /** + * Get the header associated with this ZipEntry. + */ + header: Buffer; + /** + * Retrieve the compressed data for this entry. Note that this may trigger + * compression if any properties were modified. + */ + getCompressedData(): Buffer; + /** + * Asynchronously retrieve the compressed data for this entry. Note that + * this may trigger compression if any properties were modified. + */ + getCompressedDataAsync(callback: (data: Buffer) => void): void; + /** + * Set the (uncompressed) data to be associated with this entry. + */ + setData(value: string): void; + /** + * Set the (uncompressed) data to be associated with this entry. + */ + setData(value: Buffer): void; + /** + * Get the decompressed data associated with this entry. + */ + getData(): Buffer; + /** + * Asynchronously get the decompressed data associated with this entry. + */ + getDataAsync(callback: (data: Buffer) => void): void; + /** + * Returns the CEN Entry Header to be written to the output zip file, plus + * the extra data and the entry comment. + */ + packHeader(): Buffer; + /** + * Returns a nicely formatted string with the most important properties of + * the ZipEntry. + */ + toString(): string; + } } -} -declare module "adm-zip" { - import zipFile = AdmZip.ZipFile; - export = zipFile; + export = AdmZip; } From 770a3bb179aab719b753a62001d8cb96c95cb98b Mon Sep 17 00:00:00 2001 From: Jacques Kang Date: Wed, 25 Nov 2015 21:55:00 +0100 Subject: [PATCH 051/107] Improve IonicActionSheetOptions Ref: http://ionicframework.com/docs/api/service/$ionicActionSheet/ --- ionic/ionic-tests.ts | 12 +++++++++--- ionic/ionic.d.ts | 9 ++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ionic/ionic-tests.ts b/ionic/ionic-tests.ts index cfb8825303..c68846715e 100644 --- a/ionic/ionic-tests.ts +++ b/ionic/ionic-tests.ts @@ -84,13 +84,19 @@ class IonicTestController { private testActionSheet(): void { var closeActionSheetFn: ()=>void = this.$ionicActionSheet.show({ - buttons: [], + buttons: [{ text: 'A button' }], titleText: "titleText", cancelText: "cancelText", destructiveText: "destructiveText", cancel: ()=>{ console.log("cancel"); }, - buttonClicked: ()=>{ console.log("buttonClicked"); }, - destructiveButtonClicked: ()=>{ console.log("destructiveButtonClicked"); }, + buttonClicked: (index)=>{ + console.log("buttonClicked"); + return index === 0; + }, + destructiveButtonClicked: ()=>{ + console.log("destructiveButtonClicked"); + return false; + }, cancelOnStateChange: true, cssClass: "cssClass" }); diff --git a/ionic/ionic.d.ts b/ionic/ionic.d.ts index 3014d25a8d..bb009df513 100644 --- a/ionic/ionic.d.ts +++ b/ionic/ionic.d.ts @@ -102,14 +102,17 @@ declare module ionic { interface IonicActionSheetService { show(options: IonicActionSheetOptions): ()=>void; } + interface IonicActionSheetButton { + text: string; + } interface IonicActionSheetOptions { - buttons?: Array; + buttons?: Array; titleText?: string; cancelText?: string; destructiveText?: string; cancel?: ()=>any; - buttonClicked?: (index: any)=>any; - destructiveButtonClicked?: ()=>any; + buttonClicked?: (index: number)=>boolean; + destructiveButtonClicked?: ()=>boolean; cancelOnStateChange?: boolean; cssClass?: string; } From c0326f4d621e44118a60e629adce70b80f629519 Mon Sep 17 00:00:00 2001 From: Joe Skeen Date: Wed, 25 Nov 2015 14:29:34 -0700 Subject: [PATCH 052/107] Added additional test --- adm-zip/adm-zip-tests.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/adm-zip/adm-zip-tests.ts b/adm-zip/adm-zip-tests.ts index c1e62e7f2a..93f8f2f2d7 100644 --- a/adm-zip/adm-zip-tests.ts +++ b/adm-zip/adm-zip-tests.ts @@ -55,3 +55,7 @@ zip.extractEntryTo("folder/subfolder/myfile.txt", "/home/user/", true, true); // will extract the file myfile.txt from the archive to /home/user/myfile.txt zip.extractEntryTo("folder/subfolder/myfile.txt", "/home/user/", false, true); + +function isAdmZipEntry(obj: any): obj is AdmZip.IZipEntry { + return obj !== null && typeof obj === "object" && typeof obj['entryName'] === 'string'; +} \ No newline at end of file From 2830f7f722ef6e0a05115f143f9621517c35acf5 Mon Sep 17 00:00:00 2001 From: Maximilian Friedmann Date: Wed, 25 Nov 2015 22:54:59 +0100 Subject: [PATCH 053/107] Update meteor.d.ts collection.remove returns the number of removed items, just like update/upsert etc., see http://docs.meteor.com/#/full/remove --- meteor/meteor.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meteor/meteor.d.ts b/meteor/meteor.d.ts index ee6c1db412..222de7ae7d 100644 --- a/meteor/meteor.d.ts +++ b/meteor/meteor.d.ts @@ -616,7 +616,7 @@ declare module Mongo { insert(doc: T, callback?: Function): string; rawCollection(): any; rawDatabase(): any; - remove(selector: Mongo.Selector | Mongo.ObjectID | string, callback?: Function): void; + remove(selector: Mongo.Selector | Mongo.ObjectID | string, callback?: Function): number; update(selector: Mongo.Selector | Mongo.ObjectID | string, modifier: Mongo.Modifier, options?: { multi?: boolean; upsert?: boolean; From 99167e24770d36b6bc4e14c75bc28d7f3409f437 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Thu, 26 Nov 2015 06:30:50 +0500 Subject: [PATCH 054/107] lodash: signatures of _.fill have been changed --- lodash/lodash-tests.ts | 57 +++++++++++++++++-- lodash/lodash.d.ts | 124 +++++++++++++++++++++++++---------------- 2 files changed, 126 insertions(+), 55 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 30c0b99344..a34d45f62d 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -453,13 +453,58 @@ module TestDropWhile { } // _.fill -var testFillArray = [1, 2, 3]; -var testFillList: _.List = {0: 1, 1: 2, 2: 3, length: 3}; +module TestFill { + let array: number[]; + let list: _.List; -result = _.fill(testFillArray, 'a', 0, 3); -result = <_.List>_.fill(testFillList, 'a', 0, 3); -result = _(testFillArray).fill(0, 0, 3).value(); -result = <_.List>_(testFillList).fill(0, 0, 3).value(); + { + let result: number[]; + + result = _.fill(array, 42); + result = _.fill(array, 42, 0); + result = _.fill(array, 42, 0, 10); + } + + { + let result: _.List; + + result = _.fill(list, 42); + result = _.fill(list, 42, 0); + result = _.fill(list, 42, 0, 10); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).fill(42); + result = _(array).fill(42, 0); + result = _(array).fill(42, 0, 10); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.List>; + + result = _(list).fill(42); + result = _(list).fill(42, 0); + result = _(list).fill(42, 0, 10); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().fill(42); + result = _(array).chain().fill(42, 0); + result = _(array).chain().fill(42, 0, 10); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.List>; + + result = _(list).chain().fill(42); + result = _(list).chain().fill(42, 0); + result = _(list).chain().fill(42, 0, 10); + } +} // _.findIndex module TestFindIndex { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 73a783b64c..dbc21db5f0 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -749,6 +749,81 @@ declare module _ { ): LoDashExplicitArrayWrapper; } + //_.fill + interface LoDashStatic { + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + fill( + array: any[], + value: T, + start?: number, + end?: number + ): T[]; + + /** + * @see _.fill + */ + fill( + array: List, + value: T, + start?: number, + end?: number + ): List; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashExplicitObjectWrapper>; + } + //_.findIndex interface LoDashStatic { /** @@ -4552,55 +4627,6 @@ declare module _ { ): LoDashExplicitWrapper; } - //_.fill - interface LoDashStatic { - /** - * Fills elements of array with value from start up to, but not including, end. - * - * Note: This method mutates array. - * - * @param array (Array): The array to fill. - * @param value (*): The value to fill array with. - * @param [start=0] (number): The start position. - * @param [end=array.length] (number): The end position. - * @return (Array): Returns array. - */ - fill( - array: any[], - value: any, - start?: number, - end?: number): TResult[]; - - /** - * @see _.fill - */ - fill( - array: List, - value: any, - start?: number, - end?: number): List; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.fill - */ - fill( - value: TResult, - start?: number, - end?: number): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.fill - */ - fill( - value: TResult, - start?: number, - end?: number): LoDashImplicitObjectWrapper>; - } - //_.filter interface LoDashStatic { /** From 879969aa283663106903181dd3d760d6f743f23d Mon Sep 17 00:00:00 2001 From: book010 Date: Thu, 26 Nov 2015 12:20:30 +0800 Subject: [PATCH 055/107] update text to textContent for 1.0.0-rc5 --- angular-material/angular-material.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts index 54ef2507b3..e87f33710a 100644 --- a/angular-material/angular-material.d.ts +++ b/angular-material/angular-material.d.ts @@ -116,7 +116,7 @@ declare module angular.material { } interface IToastPreset { - content(content: string): T; + textContent(content: string): T; action(action: string): T; highlightAction(highlightAction: boolean): T; capsule(capsule: boolean): T; From abacf3f78af1ec0fd906bca738e6a8d940a50779 Mon Sep 17 00:00:00 2001 From: book010 Date: Thu, 26 Nov 2015 12:22:02 +0800 Subject: [PATCH 056/107] update content to textContent for 1.0.0-rc5 md-toast now uses textContent instead of content - content is deprecated --- angular-material/angular-material-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-material/angular-material-tests.ts b/angular-material/angular-material-tests.ts index a9cd52437a..3c70dd27e8 100644 --- a/angular-material/angular-material-tests.ts +++ b/angular-material/angular-material-tests.ts @@ -96,5 +96,5 @@ myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.materia }); myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.IToastService) => { - $scope['openToast'] = () => $mdToast.show($mdToast.simple().content('Hello!')); -}); \ No newline at end of file + $scope['openToast'] = () => $mdToast.show($mdToast.simple().textContent('Hello!')); +}); From 732f2f4bc1fed1f44cb68eab68b66fb14f895ee4 Mon Sep 17 00:00:00 2001 From: bgrieder Date: Thu, 26 Nov 2015 05:46:09 +0100 Subject: [PATCH 057/107] improved definitions so that react-native 'extends' react rather thane 're-exports' react --- react-native/react-native.d.ts | 231 +++------------------------------ 1 file changed, 17 insertions(+), 214 deletions(-) diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index dacfbc7f08..dc6cc5e3c5 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -5,21 +5,24 @@ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // -// These definitions are meant to be used with the TSC compiler target set to ES6 +// USING: these definitions are meant to be used with the TSC compiler target set to ES6 // -// These definitions have been mostly completed by porting to Typescript -// the UI Explorer which comes with the react-native distribution -// Check: https://github.com/bgrieder/RNTSExplorer +// USAGE EXAMPLES: check the RNTSExplorer project at https://github.com/bgrieder/RNTSExplorer // -// This work is based on an original work made by Bernd Paradies: https://github.com/bparadie +// CONTRIBUTING: please open pull requests and make sure that the changes do not break RNTSExplorer (they should not) +// Do not hesitate to open a pull request against RNTSExplorer to provide an example for a case not covered by the current App +// +// CREDITS: This work is based on an original work made by Bernd Paradies: https://github.com/bparadie // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// +//so we know what is "original" React import React = __React; -declare namespace ReactNative { +//react-native "extends" react +declare namespace __React { /** @@ -118,6 +121,7 @@ declare namespace ReactNative { // @see lib.es6.d.ts export var Promise: PromiseConstructor; + //TODO: BGR: Replace with ComponentClass ? // node_modules/react-tools/src/classic/class/ReactClass.js export interface ReactClass { // TODO: @@ -3411,214 +3415,11 @@ declare namespace ReactNative { export type DeviceEventSubscription = DeviceEventSubscriptionStatic export var InteractionManager: InteractionManagerStatic - ////////////////////////////////////////////////////////////////////////// - // - // R E A C T - 0 . 1 4 - // - ////////////////////////////////////////////////////////////////////////// - - - export type ReactType = React.ReactType; - - export interface ReactElement

extends React.ReactElement

{} - - export interface ClassicElement

extends React.ClassicElement

{} - - export interface DOMElement

extends React.DOMElement

{} - - export type HTMLElement =React.ReactHTMLElement; - export type SVGElement = React.ReactSVGElement; - - // - // Factories - // ---------------------------------------------------------------------- - - export interface Factory

extends React.Factory

{} - - export interface ClassicFactory

extends React.ClassicFactory

{} - - export interface DOMFactory

extends React.DOMFactory

{} - - export type HTMLFactory = React.HTMLFactory; - export type SVGFactory = React.SVGFactory; - - // - // React Nodes - // http://facebook.github.io/react/docs/glossary.html - // ---------------------------------------------------------------------- - - export type ReactText = React.ReactText; - export type ReactChild = React.ReactChild; - - // Should be Array but type aliases cannot be recursive - export type ReactFragment = React.ReactFragment; - export type ReactNode = React.ReactNode; - - // - // Top Level API - // ---------------------------------------------------------------------- - - export function createClass( spec: React.ComponentSpec ): React.ClassicComponentClass

; - - export function createFactory

( type: string ): React.DOMFactory

; - export function createFactory

( type: React.ClassicComponentClass

| string ): React.ClassicFactory

; - export function createFactory

( type: React.ComponentClass

): React.Factory

; - - export function createElement

( type: string, - props?: P, - ...children: React.ReactNode[] ): React.DOMElement

; - export function createElement

( type: React.ClassicComponentClass

| string, - props?: P, - ...children: React.ReactNode[] ): React.ClassicElement

; - export function createElement

( type: React.ComponentClass

, - props?: P, - ...children: React.ReactNode[] ): React.ReactElement

; - - export function cloneElement

( element: React.DOMElement

, - props?: P, - ...children: React.ReactNode[] ): React.DOMElement

; - export function cloneElement

( element: React.ClassicElement

, - props?: P, - ...children: React.ReactNode[] ): React.ClassicElement

; - export function cloneElement

( element: React.ReactElement

, - props?: P, - ...children: React.ReactNode[] ): React.ReactElement

; - - export function isValidElement( object: {} ): boolean; - - export var DOM: React.ReactDOM; - export var PropTypes: React.ReactPropTypes; - export var Children: React.ReactChildren; - - // - // Component API - // ---------------------------------------------------------------------- - - // Base component for plain JS classes - export class Component extends React.Component {} - - export interface ClassicComponent extends React.ClassicComponent {} - - export interface DOMComponent

extends ClassicComponent { - tagName: string; - } - - export interface ChildContextProvider extends React.ChildContextProvider {} - - // - // Class Interfaces - // ---------------------------------------------------------------------- - - export interface ComponentClass

extends React.ComponentClass

{} - - export interface ClassicComponentClass

extends React.ClassicComponentClass

{} - - // - // Component Specs and Lifecycle - // ---------------------------------------------------------------------- - - export interface ComponentLifecycle extends React.ComponentLifecycle {} - - export interface Mixin extends React.Mixin {} - - export interface ComponentSpec extends React.ComponentSpec {} - - // - // Event System - // ---------------------------------------------------------------------- - - export interface SyntheticEvent extends React.SyntheticEvent {} - - export interface DragEvent extends React.DragEvent {} - - export interface ClipboardEvent extends React.ClipboardEvent {} - - export interface KeyboardEvent extends React.KeyboardEvent {} - - - export interface FocusEvent extends React.FocusEvent {} - - export interface FormEvent extends React.FormEvent {} - - export interface MouseEvent extends React.MouseEvent {} - - export interface TouchEvent extends React.TouchEvent {} - - export interface UIEvent extends React.UIEvent {} - - export interface WheelEvent extends React.WheelEvent {} - - // - // Event Handler Types - // ---------------------------------------------------------------------- - - export interface EventHandler extends React.EventHandler {} - - export interface DragEventHandler extends React.DragEventHandler {} - export interface ClipboardEventHandler extends React.ClipboardEventHandler {} - export interface KeyboardEventHandler extends React.KeyboardEventHandler {} - export interface FocusEventHandler extends React.FocusEventHandler {} - export interface FormEventHandler extends React.FormEventHandler {} - export interface MouseEventHandler extends React.MouseEventHandler {} - export interface TouchEventHandler extends React.TouchEventHandler {} - export interface UIEventHandler extends React.UIEventHandler {} - export interface WheelEventHandler extends React.WheelEventHandler {} - - // - // Props / DOM Attributes - // ---------------------------------------------------------------------- - - export interface Props extends React.Props {} - - export interface DOMAttributes extends React.DOMAttributes {} - - // This interface is not complete. Only properties accepting - // unitless numbers are listed here (see CSSProperty.js in React) - export interface CSSProperties extends React.CSSProperties {} - - export interface HTMLAttributes extends React.HTMLAttributes {} - - export interface SVGAttributes extends React.SVGAttributes {} - - // - // React.DOM - // ---------------------------------------------------------------------- - - export interface ReactDOM extends React.ReactDOM {} - - // - // React.PropTypes - // ---------------------------------------------------------------------- - - export interface Validator extends React.Validator {} - - export interface Requireable extends React.Requireable {} - - export interface ValidationMap extends React.ValidationMap {} - - export interface ReactPropTypes extends React.ReactPropTypes {} - - // - // React.Children - // ---------------------------------------------------------------------- - - export interface ReactChildren extends React.ReactChildren {} - - // - // Browser Interfaces - // https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts - // ---------------------------------------------------------------------- - - export interface AbstractView extends React.AbstractView {} - - export interface Touch extends React.Touch {} - - export interface TouchList extends React.TouchList {} - // // Additional ( and controversial) // + ////////////////////////////////////////////////////////////////////////// export function __spread( target: any, ...sources: any[] ): any; @@ -3657,10 +3458,16 @@ declare namespace ReactNative { declare module "react-native" { + import ReactNative = __React export default ReactNative } +declare var global: __React.GlobalStatic +declare function require( name: string ): any + + +//TODO: BGR: this is a left-over from the initial port. Not sure it makes any sense declare module "Dimensions" { import React from 'react-native'; @@ -3671,7 +3478,3 @@ declare module "Dimensions" { var ExportDimensions: Dimensions; export = ExportDimensions; } - -declare var global: ReactNative.GlobalStatic - -declare function require( name: string ): any From afb6532a96b7a00810b56dc8f90f6934a62b99d1 Mon Sep 17 00:00:00 2001 From: JJJ Date: Thu, 26 Nov 2015 15:00:20 +0800 Subject: [PATCH 058/107] update version to 1.0.0-rc5 --- angular-material/angular-material.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts index e87f33710a..43e0b9f53b 100644 --- a/angular-material/angular-material.d.ts +++ b/angular-material/angular-material.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular Material 0.10.1-rc1+ (angular.material module) +// Type definitions for Angular Material 1.0.0-rc5+ (angular.material module) // Project: https://github.com/angular/material // Definitions by: Matt Traynham // Definitions: https://github.com/borisyankov/DefinitelyTyped From 148598770764cc57e0b5fa6c2488c0ba87865985 Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Thu, 26 Nov 2015 09:10:18 +0200 Subject: [PATCH 059/107] Add compose-function typings --- compose-function/compose-function-tests.ts | 21 +++++++++++++++ compose-function/compose-function.d.ts | 31 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 compose-function/compose-function-tests.ts create mode 100644 compose-function/compose-function.d.ts diff --git a/compose-function/compose-function-tests.ts b/compose-function/compose-function-tests.ts new file mode 100644 index 0000000000..dd0a80feff --- /dev/null +++ b/compose-function/compose-function-tests.ts @@ -0,0 +1,21 @@ +/// + +const numberToNumber = (a: number): number => a + 2; +const numberToString = (a: number): string => "foo"; +const stringToNumber = (a: string): number => 5; + +import composeFunction = require("compose-function"); +const t1: number = composeFunction(numberToNumber, numberToNumber)(5); +const t2: string = composeFunction(numberToString, numberToNumber)(5); +const t3: string = composeFunction(numberToString, stringToNumber)("f"); +const t4: (a: string) => number = composeFunction( + (f: (a: string) => number) => ((p: string) => 5), + (f: (a: number) => string) => ((p: string) => 4) + )(numberToString); + + +const t5: number = composeFunction(stringToNumber, numberToString, numberToNumber)(5); +const t6: string = composeFunction(numberToString, stringToNumber, numberToString, numberToNumber)(5); + +const t7: string = composeFunction( + numberToString, numberToNumber, stringToNumber, numberToString, stringToNumber)("fo"); diff --git a/compose-function/compose-function.d.ts b/compose-function/compose-function.d.ts new file mode 100644 index 0000000000..d4f205fd32 --- /dev/null +++ b/compose-function/compose-function.d.ts @@ -0,0 +1,31 @@ +// Type definitions for compose-function +// Project: https://github.com/stoeffel/compose-function +// Definitions by: Denis Sokolov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "compose-function" { + // Hardcoded signatures for 2-4 parameters + function f( + f1: (b: B) => C, + f2: (a: A) => B + ): (a: A) => C + function f( + f1: (b: C) => D, + f2: (a: B) => C, + f3: (a: A) => B + ): (a: A) => D + function f( + f1: (b: D) => E, + f2: (a: C) => D, + f3: (a: B) => C, + f4: (a: A) => B + ): (a: A) => E + + // Minimal typing for more than 4 parameters + function f( + f1: (a: any) => Result, + ...functions: Function[] + ): (a: any) => Result + + export = f; +} From 3efcdc303430181781369d962374a217d5584a33 Mon Sep 17 00:00:00 2001 From: Shlomi Assaf Date: Thu, 26 Nov 2015 12:37:27 +0200 Subject: [PATCH 060/107] Add resumeBootstrap to IAngularStatic --- angularjs/angular.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 1b54bac2a6..ee8a94db64 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -165,6 +165,12 @@ declare module angular { dot: number; codeName: string; }; + + /** + * If window.name contains prefix NG_DEFER_BOOTSTRAP! when angular.bootstrap is called, the bootstrap process will be paused until angular.resumeBootstrap() is called. + * @param extraModules An optional array of modules that should be added to the original list of modules that the app was about to be bootstrapped with. + */ + resumeBootstrap?(extraModules?: string[]): ng.auto.IInjectorService; } /////////////////////////////////////////////////////////////////////////// From eff4af0407b08a4b2653cfa2a351447007e32d0a Mon Sep 17 00:00:00 2001 From: Sam Verschueren Date: Thu, 26 Nov 2015 14:06:32 +0100 Subject: [PATCH 061/107] Add query-string --- query-string/query-string-tests.ts | 13 +++++++++++++ query-string/query-string.d.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 query-string/query-string-tests.ts create mode 100644 query-string/query-string.d.ts diff --git a/query-string/query-string-tests.ts b/query-string/query-string-tests.ts new file mode 100644 index 0000000000..597d270f2e --- /dev/null +++ b/query-string/query-string-tests.ts @@ -0,0 +1,13 @@ +/// + +import qs = require('query-string'); + +qs.stringify({ foo: 'bar' }); +qs.stringify({ foo: 'bar', bar: 'baz' }); + +qs.parse('?foo=bar'); +qs.parse('#foo=bar'); +qs.parse('&foo=bar&foo=baz'); + +qs.extract('http://foo.bar/?abc=def&hij=klm'); +qs.extract('http://foo.bar/?foo=bar'); diff --git a/query-string/query-string.d.ts b/query-string/query-string.d.ts new file mode 100644 index 0000000000..e4d76d0030 --- /dev/null +++ b/query-string/query-string.d.ts @@ -0,0 +1,27 @@ +// Type definitions for query-string v3.0.0 +// Project: https://github.com/sindresorhus/query-string +// Definitions by: Sam Verschueren +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "query-string" { + /** + * Parse a query string into an object. + * Leading ? or # are ignored, so you can pass location.search or location.hash directly. + * @param str + */ + export function parse(str: string): any; + + /** + * Stringify an object into a query string, sorting the keys. + * + * @param obj + */ + export function stringify(obj: any): string; + + /** + * Extract a query string from a URL that can be passed into .parse(). + * + * @param str + */ + export function extract(str: string): string; +} From a5ff255a5d98135895f2469da4f9caef13dd2e1a Mon Sep 17 00:00:00 2001 From: Rainer ziller Date: Thu, 26 Nov 2015 15:56:52 +0100 Subject: [PATCH 062/107] Add QunitAssert parameter to setup functions Add QunitAssert parameter to the setup, teardown, beforeEach and afterEach functions. This facilitates the usage of for example async code in the setup. --- qunit/qunit-tests.ts | 24 ++++++++++++++++++++++++ qunit/qunit.d.ts | 12 ++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/qunit/qunit-tests.ts b/qunit/qunit-tests.ts index dd0335aedc..9a3486118f 100644 --- a/qunit/qunit-tests.ts +++ b/qunit/qunit-tests.ts @@ -170,6 +170,30 @@ QUnit.module("module A", { } }); +QUnit.module("module with async setup and teardown", { + setup: function (assert) { + var done = assert.async(); + setTimeout(function () { + // prepare something for all following tests + }); + }, + teardown: function (assert) { + // clean up after each test + } +}); + +QUnit.module("module with async setup and teardown", { + beforeEach: function (assert: QUnitAssert) { + var done = assert.async(); + setTimeout(function () { + // prepare something for all following tests + }); + }, + afterEach: function () { + // clean up after each test + } +}); + QUnit.test("a test", function (assert) { function square(x) { diff --git a/qunit/qunit.d.ts b/qunit/qunit.d.ts index fde535a688..98b513b9ae 100644 --- a/qunit/qunit.d.ts +++ b/qunit/qunit.d.ts @@ -148,23 +148,27 @@ interface URLConfigItem { interface LifecycleObject { /** * Runs before each test + * @param assert * @deprecated */ - setup?: () => void; + setup?: (assert: QUnitAssert) => void; /** * Runs after each test + * @param assert * @deprecated */ - teardown?: () => void; + teardown?: (assert: QUnitAssert) => void; /** * Runs before each test + * @param assert */ - beforeEach?: () => void; + beforeEach?: (assert: QUnitAssert) => void; /** * Runs after each test + * @param assert */ - afterEach?: () => void; + afterEach?: (assert: QUnitAssert) => void; /** * Any additional properties on the hooks object will be added to that context. From 1e9df33f6baf97425a92090ca233d835dd8a756f Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Fri, 27 Nov 2015 01:10:41 +0900 Subject: [PATCH 063/107] Fix gulp-babel.d.ts --- gulp-babel/gulp-babel-tests.ts | 2 +- gulp-babel/gulp-babel.d.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gulp-babel/gulp-babel-tests.ts b/gulp-babel/gulp-babel-tests.ts index 75175cf6f5..e5daf3617a 100644 --- a/gulp-babel/gulp-babel-tests.ts +++ b/gulp-babel/gulp-babel-tests.ts @@ -1,7 +1,7 @@ /// /// -import babel from 'gulp-babel'; +import babel = require('gulp-babel'); var x: NodeJS.ReadWriteStream = babel(); var x: NodeJS.ReadWriteStream = babel({}); diff --git a/gulp-babel/gulp-babel.d.ts b/gulp-babel/gulp-babel.d.ts index 36846cac43..98d33881cf 100644 --- a/gulp-babel/gulp-babel.d.ts +++ b/gulp-babel/gulp-babel.d.ts @@ -6,7 +6,7 @@ /// declare module 'gulp-babel' { - export default function(options?: { + function babel(options?: { filename?: string, filenameRelative?: string, presets?: string[], @@ -35,4 +35,6 @@ declare module 'gulp-babel' { env?: any, retainLines?: boolean }): NodeJS.ReadWriteStream; + + export = babel; } From 81516e3ef9fbd4aa349388173b31ac18815b2843 Mon Sep 17 00:00:00 2001 From: Attila Gazso Date: Thu, 26 Nov 2015 21:19:23 +0100 Subject: [PATCH 064/107] Added missing playsinline to PlayerVars As seen at https://developers.google.com/youtube/player_parameters --- youtube/youtube.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/youtube/youtube.d.ts b/youtube/youtube.d.ts index 6e5066cf97..a90ab4c88a 100644 --- a/youtube/youtube.d.ts +++ b/youtube/youtube.d.ts @@ -44,6 +44,7 @@ declare module YT { origin?: string; playerpiid?: string; playlist?: string[]; + playsinline?: number; rel?: number; showinfo?: number; start?: number; From f172a40ea2dbae7accea16e6c5f058ca384dd739 Mon Sep 17 00:00:00 2001 From: Lukasz Potapczuk Date: Thu, 26 Nov 2015 21:25:22 +0100 Subject: [PATCH 065/107] Renamed ng-stomp test file --- ng-stomp/{ng-stomp-test.ts => ng-stomp-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ng-stomp/{ng-stomp-test.ts => ng-stomp-tests.ts} (100%) diff --git a/ng-stomp/ng-stomp-test.ts b/ng-stomp/ng-stomp-tests.ts similarity index 100% rename from ng-stomp/ng-stomp-test.ts rename to ng-stomp/ng-stomp-tests.ts From a8e7febb506b0c04222087368c0e155e80bbfb20 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 27 Nov 2015 04:51:57 +0500 Subject: [PATCH 066/107] lodash: signatures of _.forEach and _.forEachRight have been changed --- lodash/lodash.d.ts | 124 +++++++++++++++++++++++++++++---------------- 1 file changed, 80 insertions(+), 44 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ad465c5c39..53c98e9d7a 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -4215,15 +4215,6 @@ declare module _ { //_.each interface LoDashStatic { - /** - * @see _.forEach - */ - each( - collection: string, - iteratee?: StringIterator, - thisArg?: any - ): string; - /** * @see _.forEach */ @@ -4250,6 +4241,24 @@ declare module _ { iteratee?: DictionaryIterator, thisArg?: any ): Dictionary; + + /** + * @see _.forEach + */ + each( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEach + */ + each( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; } interface LoDashImplicitWrapper { @@ -4257,7 +4266,7 @@ declare module _ { * @see _.forEach */ each( - iteratee: StringIterator, + iteratee: ListIterator, thisArg?: any ): LoDashImplicitWrapper; } @@ -4287,7 +4296,7 @@ declare module _ { * @see _.forEach */ each( - iteratee: StringIterator, + iteratee: ListIterator, thisArg?: any ): LoDashExplicitWrapper; } @@ -4314,15 +4323,6 @@ declare module _ { //_.eachRight interface LoDashStatic { - /** - * @see _.forEachRight - */ - eachRight( - collection: string, - iteratee?: StringIterator, - thisArg?: any - ): string; - /** * @see _.forEachRight */ @@ -4349,6 +4349,24 @@ declare module _ { iteratee?: DictionaryIterator, thisArg?: any ): Dictionary; + + /** + * @see _.forEachRight + */ + eachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEachRight + */ + eachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; } interface LoDashImplicitWrapper { @@ -4356,7 +4374,7 @@ declare module _ { * @see _.forEachRight */ eachRight( - iteratee: StringIterator, + iteratee: ListIterator, thisArg?: any ): LoDashImplicitWrapper; } @@ -4386,7 +4404,7 @@ declare module _ { * @see _.forEachRight */ eachRight( - iteratee: StringIterator, + iteratee: ListIterator, thisArg?: any ): LoDashExplicitWrapper; } @@ -5089,15 +5107,6 @@ declare module _ { * @param iteratee The function invoked per iteration. * @param thisArg The this binding of iteratee. */ - forEach( - collection: string, - iteratee?: StringIterator, - thisArg?: any - ): string; - - /** - * @see _.forEach - */ forEach( collection: T[], iteratee?: ListIterator, @@ -5121,6 +5130,24 @@ declare module _ { iteratee?: DictionaryIterator, thisArg?: any ): Dictionary; + + /** + * @see _.forEach + */ + forEach( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEach + */ + forEach( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; } interface LoDashImplicitWrapper { @@ -5128,7 +5155,7 @@ declare module _ { * @see _.forEach */ forEach( - iteratee: StringIterator, + iteratee: ListIterator, thisArg?: any ): LoDashImplicitWrapper; } @@ -5158,7 +5185,7 @@ declare module _ { * @see _.forEach */ forEach( - iteratee: StringIterator, + iteratee: ListIterator, thisArg?: any ): LoDashExplicitWrapper; } @@ -5194,15 +5221,6 @@ declare module _ { * @param iteratee The function called per iteration. * @param thisArg The this binding of callback. */ - forEachRight( - collection: string, - iteratee?: StringIterator, - thisArg?: any - ): string; - - /** - * @see _.forEachRight - */ forEachRight( collection: T[], iteratee?: ListIterator, @@ -5226,6 +5244,24 @@ declare module _ { iteratee?: DictionaryIterator, thisArg?: any ): Dictionary; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; } interface LoDashImplicitWrapper { @@ -5233,7 +5269,7 @@ declare module _ { * @see _.forEachRight */ forEachRight( - iteratee: StringIterator, + iteratee: ListIterator, thisArg?: any ): LoDashImplicitWrapper; } @@ -5263,7 +5299,7 @@ declare module _ { * @see _.forEachRight */ forEachRight( - iteratee: StringIterator, + iteratee: ListIterator, thisArg?: any ): LoDashExplicitWrapper; } From 06869f8867912caea060ef46014d9712f18d70c4 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 27 Nov 2015 05:47:07 +0500 Subject: [PATCH 067/107] lodash: signatures of _.findLastKey have been changed --- lodash/lodash-tests.ts | 28 ++++++++++++++++++++++++++-- lodash/lodash.d.ts | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bdc08ccdc7..a70ea2178e 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6117,10 +6117,9 @@ module TestFindKey { // _.findLastKey module TestFindLastKey { - let result: string; - { let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: string; result = _.findLastKey<{a: string;}>({a: ''}); @@ -6147,6 +6146,7 @@ module TestFindLastKey { { let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: string; result = _.findLastKey({a: ''}, predicateFn); result = _.findLastKey({a: ''}, predicateFn, any); @@ -6154,6 +6154,30 @@ module TestFindLastKey { result = _<{a: string;}>({a: ''}).findLastKey(predicateFn); result = _<{a: string;}>({a: ''}).findLastKey(predicateFn, any); } + + { + let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findLastKey(); + + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn, any); + + + result = _<{a: string;}>({a: ''}).chain().findLastKey(''); + result = _<{a: string;}>({a: ''}).chain().findLastKey('', any); + + result = _<{a: string;}>({a: ''}).chain().findLastKey<{a: number;}>({a: 42}); + } + + { + let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn, any); + } } // _.forIn diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ad465c5c39..0ccab91311 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10544,6 +10544,39 @@ declare module _ { ): string; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: ObjectIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey>( + predicate?: TWhere + ): LoDashExplicitWrapper; + } + //_.forIn interface LoDashStatic { /** From d7e89a66fd7ffc56bee5e8a226fc7145a17f7b86 Mon Sep 17 00:00:00 2001 From: Vasya Aksyonov Date: Fri, 27 Nov 2015 15:18:18 +0500 Subject: [PATCH 068/107] js-combinatorics typings and tests --- .../js-combinatorics-global-tests.ts | 93 ++++++++++++ js-combinatorics/js-combinatorics-global.d.ts | 8 ++ js-combinatorics/js-combinatorics-tests.ts | 95 ++++++++++++ js-combinatorics/js-combinatorics.d.ts | 135 ++++++++++++++++++ 4 files changed, 331 insertions(+) create mode 100644 js-combinatorics/js-combinatorics-global-tests.ts create mode 100644 js-combinatorics/js-combinatorics-global.d.ts create mode 100644 js-combinatorics/js-combinatorics-tests.ts create mode 100644 js-combinatorics/js-combinatorics.d.ts diff --git a/js-combinatorics/js-combinatorics-global-tests.ts b/js-combinatorics/js-combinatorics-global-tests.ts new file mode 100644 index 0000000000..b8cbd3525c --- /dev/null +++ b/js-combinatorics/js-combinatorics-global-tests.ts @@ -0,0 +1,93 @@ +/// + +const p:number = Combinatorics.P(1, 2); +const c:number = Combinatorics.C(1, 2); +const factorial:number = Combinatorics.factorial(5); +const factoradic:number[] = Combinatorics.factoradic(5); + +const power = Combinatorics.power(["a", "b", "c"]); +const nextPower:string[] = power.next(); +power.forEach((i:string[]) => console.log(i)); +const powersLengths:number[] = power.map((i:string[]) => i.length); +const filteredPowers:string[][] = power.filter((i:string[]) => i.length > 0); +const allPowers:string[][] = power.toArray(); +const powersCount = power.length; +const nthPower:string[] = power.nth(3); + +const limitedCombination = Combinatorics.combination(["a", "b", "c"], 2); +const combination = Combinatorics.combination(["a", "b", "c"]); +const nextCombination:string[] = combination.next(); +combination.forEach((i:string[]) => console.log(i)); +const combinationsLengths:number[] = combination.map((i:string[]) => i.length); +const filteredCombinations:string[][] = combination.filter((i:string[]) => i.length > 0); +const allCombinations:string[][] = combination.toArray(); +const combinationsCount = combination.length; + +const limitedPermutation = Combinatorics.permutation(["a", "b", "c"], 2); +const permutation = Combinatorics.permutation(["a", "b", "c"]); +const nextPermutation:string[] = permutation.next(); +permutation.forEach((i:string[]) => console.log(i)); +const permutationsLengths:number[] = permutation.map((i:string[]) => i.length); +const filteredPermutations:string[][] = permutation.filter((i:string[]) => i.length > 0); +const allPermutations:string[][] = permutation.toArray(); +const permutationsCount = permutation.length; + +const permutationCombination = Combinatorics.permutationCombination(["a", "b", "c"]); +const nextPermutationCombinations:string[] = permutationCombination.next(); +permutationCombination.forEach((i:string[]) => console.log(i)); +const permutationCombinationsLengths:number[] = permutationCombination.map((i:string[]) => i.length); +const filteredPermutationCombinationss:string[][] = permutationCombination.filter((i:string[]) => i.length > 0); +const allPermutationCombinationss:string[][] = permutationCombination.toArray(); +const permutationCombinationsCount = permutationCombination.length; + +const limitedBaseN = Combinatorics.baseN(["a", "b", "c"], 2); +const baseN = Combinatorics.baseN(["a", "b", "c"]); +const nextbaseN:string[] = baseN.next(); +baseN.forEach((i:string[]) => console.log(i)); +const baseNsLengths:number[] = baseN.map((i:string[]) => i.length); +const filteredbaseNs:string[][] = baseN.filter((i:string[]) => i.length > 0); +const allbaseNs:string[][] = baseN.toArray(); +const baseNsCount = baseN.length; +const nthbaseN:string[] = baseN.nth(3); + +const cartesianProduct1 = Combinatorics.cartesianProduct(["a", "b", "c"]); +const nextCartesianProduct1:[string] = cartesianProduct1.next(); +cartesianProduct1.forEach((i:[string]) => console.log(i)); +const cartesianProduct1sLengths:number[] = cartesianProduct1.map((i:[string]) => i.length); +const filteredCartesianProduct1s:[string][] = cartesianProduct1.filter((i:[string]) => i.length > 0); +const allCartesianProduct1s:[string][] = cartesianProduct1.toArray(); +const cartesianProduct1sCount = cartesianProduct1.length; +const nthCartesianProduct1:[string] = cartesianProduct1.nth(3); +const cartesianProduct1ByCoords:[string] = cartesianProduct1.get(1); + +const cartesianProduct2 = Combinatorics.cartesianProduct(["a", "b", "c"], [1, 2, 3]); +const nextCartesianProduct2:[string, number] = cartesianProduct2.next(); +cartesianProduct2.forEach((i:[string, number]) => console.log(i)); +const cartesianProduct2sLengths:number[] = cartesianProduct2.map((i:[string, number]) => i.length); +const filteredCartesianProduct2s:[string, number][] = cartesianProduct2.filter((i:[string, number]) => i.length > 0); +const allCartesianProduct2s:[string, number][] = cartesianProduct2.toArray(); +const cartesianProduct2sCount = cartesianProduct2.length; +const nthCartesianProduct2:[string, number] = cartesianProduct2.nth(3); +const cartesianProduct2ByCoords:[string, number] = cartesianProduct2.get(1, 1); + +const cartesianProduct3 = Combinatorics.cartesianProduct(["a", "b", "c"], [1, 2, 3], [true, false]); +const nextCartesianProduct3:[string, number, boolean] = cartesianProduct3.next(); +cartesianProduct3.forEach((i:[string, number, boolean]) => console.log(i)); +const cartesianProduct3sLengths:number[] = cartesianProduct3.map((i:[string, number, boolean]) => i.length); +const filteredCartesianProduct3s:[string, number, boolean][] = cartesianProduct3.filter((i:[string, number, boolean]) => i.length > 0); +const allCartesianProduct3s:[string, number, boolean][] = cartesianProduct3.toArray(); +const cartesianProduct3sCount = cartesianProduct3.length; +const nthCartesianProduct3:[string, number, boolean] = cartesianProduct3.nth(3); +const cartesianProduct3ByCoords:[string, number, boolean] = cartesianProduct3.get(1, 1); + +const cartesianProductAny = Combinatorics.cartesianProduct(["a", 1, true], [false, 2, "b"]); +const nextCartesianProductAny:any[] = cartesianProductAny.next(); +cartesianProductAny.forEach((i:any[]) => console.log(i)); +const cartesianProductAnysLengths:number[] = cartesianProductAny.map((i:any[]) => i.length); +const filteredCartesianProductAnys:any[][] = cartesianProductAny.filter((i:any[]) => i.length > 0); +const allCartesianProductAnys:any[][] = cartesianProductAny.toArray(); +const cartesianProductAnysCount = cartesianProductAny.length; +const nthCartesianProductAny:any[] = cartesianProductAny.nth(3); +const cartesianProductAnyByCoords:any[] = cartesianProductAny.get(1, 1); + +const version:string = Combinatorics.VERSION; \ No newline at end of file diff --git a/js-combinatorics/js-combinatorics-global.d.ts b/js-combinatorics/js-combinatorics-global.d.ts new file mode 100644 index 0000000000..20c302981c --- /dev/null +++ b/js-combinatorics/js-combinatorics-global.d.ts @@ -0,0 +1,8 @@ +// Type definitions for js-combinatorics v0.5.0 (global) +// Project: https://github.com/dankogai/js-combinatorics +// Definitions by: Vasya Aksyonov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +import Combinatorics = __Combinatorics; diff --git a/js-combinatorics/js-combinatorics-tests.ts b/js-combinatorics/js-combinatorics-tests.ts new file mode 100644 index 0000000000..08e04c374f --- /dev/null +++ b/js-combinatorics/js-combinatorics-tests.ts @@ -0,0 +1,95 @@ +/// + +import * as Combinatorics from "js-combinatorics"; + +const p:number = Combinatorics.P(1, 2); +const c:number = Combinatorics.C(1, 2); +const factorial:number = Combinatorics.factorial(5); +const factoradic:number[] = Combinatorics.factoradic(5); + +const power = Combinatorics.power(["a", "b", "c"]); +const nextPower:string[] = power.next(); +power.forEach((i:string[]) => console.log(i)); +const powersLengths:number[] = power.map((i:string[]) => i.length); +const filteredPowers:string[][] = power.filter((i:string[]) => i.length > 0); +const allPowers:string[][] = power.toArray(); +const powersCount = power.length; +const nthPower:string[] = power.nth(3); + +const limitedCombination = Combinatorics.combination(["a", "b", "c"], 2); +const combination = Combinatorics.combination(["a", "b", "c"]); +const nextCombination:string[] = combination.next(); +combination.forEach((i:string[]) => console.log(i)); +const combinationsLengths:number[] = combination.map((i:string[]) => i.length); +const filteredCombinations:string[][] = combination.filter((i:string[]) => i.length > 0); +const allCombinations:string[][] = combination.toArray(); +const combinationsCount = combination.length; + +const limitedPermutation = Combinatorics.permutation(["a", "b", "c"], 2); +const permutation = Combinatorics.permutation(["a", "b", "c"]); +const nextPermutation:string[] = permutation.next(); +permutation.forEach((i:string[]) => console.log(i)); +const permutationsLengths:number[] = permutation.map((i:string[]) => i.length); +const filteredPermutations:string[][] = permutation.filter((i:string[]) => i.length > 0); +const allPermutations:string[][] = permutation.toArray(); +const permutationsCount = permutation.length; + +const permutationCombination = Combinatorics.permutationCombination(["a", "b", "c"]); +const nextPermutationCombinations:string[] = permutationCombination.next(); +permutationCombination.forEach((i:string[]) => console.log(i)); +const permutationCombinationsLengths:number[] = permutationCombination.map((i:string[]) => i.length); +const filteredPermutationCombinationss:string[][] = permutationCombination.filter((i:string[]) => i.length > 0); +const allPermutationCombinationss:string[][] = permutationCombination.toArray(); +const permutationCombinationsCount = permutationCombination.length; + +const limitedBaseN = Combinatorics.baseN(["a", "b", "c"], 2); +const baseN = Combinatorics.baseN(["a", "b", "c"]); +const nextbaseN:string[] = baseN.next(); +baseN.forEach((i:string[]) => console.log(i)); +const baseNsLengths:number[] = baseN.map((i:string[]) => i.length); +const filteredbaseNs:string[][] = baseN.filter((i:string[]) => i.length > 0); +const allbaseNs:string[][] = baseN.toArray(); +const baseNsCount = baseN.length; +const nthbaseN:string[] = baseN.nth(3); + +const cartesianProduct1 = Combinatorics.cartesianProduct(["a", "b", "c"]); +const nextCartesianProduct1:[string] = cartesianProduct1.next(); +cartesianProduct1.forEach((i:[string]) => console.log(i)); +const cartesianProduct1sLengths:number[] = cartesianProduct1.map((i:[string]) => i.length); +const filteredCartesianProduct1s:[string][] = cartesianProduct1.filter((i:[string]) => i.length > 0); +const allCartesianProduct1s:[string][] = cartesianProduct1.toArray(); +const cartesianProduct1sCount = cartesianProduct1.length; +const nthCartesianProduct1:[string] = cartesianProduct1.nth(3); +const cartesianProduct1ByCoords:[string] = cartesianProduct1.get(1); + +const cartesianProduct2 = Combinatorics.cartesianProduct(["a", "b", "c"], [1, 2, 3]); +const nextCartesianProduct2:[string, number] = cartesianProduct2.next(); +cartesianProduct2.forEach((i:[string, number]) => console.log(i)); +const cartesianProduct2sLengths:number[] = cartesianProduct2.map((i:[string, number]) => i.length); +const filteredCartesianProduct2s:[string, number][] = cartesianProduct2.filter((i:[string, number]) => i.length > 0); +const allCartesianProduct2s:[string, number][] = cartesianProduct2.toArray(); +const cartesianProduct2sCount = cartesianProduct2.length; +const nthCartesianProduct2:[string, number] = cartesianProduct2.nth(3); +const cartesianProduct2ByCoords:[string, number] = cartesianProduct2.get(1, 1); + +const cartesianProduct3 = Combinatorics.cartesianProduct(["a", "b", "c"], [1, 2, 3], [true, false]); +const nextCartesianProduct3:[string, number, boolean] = cartesianProduct3.next(); +cartesianProduct3.forEach((i:[string, number, boolean]) => console.log(i)); +const cartesianProduct3sLengths:number[] = cartesianProduct3.map((i:[string, number, boolean]) => i.length); +const filteredCartesianProduct3s:[string, number, boolean][] = cartesianProduct3.filter((i:[string, number, boolean]) => i.length > 0); +const allCartesianProduct3s:[string, number, boolean][] = cartesianProduct3.toArray(); +const cartesianProduct3sCount = cartesianProduct3.length; +const nthCartesianProduct3:[string, number, boolean] = cartesianProduct3.nth(3); +const cartesianProduct3ByCoords:[string, number, boolean] = cartesianProduct3.get(1, 1); + +const cartesianProductAny = Combinatorics.cartesianProduct(["a", 1, true], [false, 2, "b"]); +const nextCartesianProductAny:any[] = cartesianProductAny.next(); +cartesianProductAny.forEach((i:any[]) => console.log(i)); +const cartesianProductAnysLengths:number[] = cartesianProductAny.map((i:any[]) => i.length); +const filteredCartesianProductAnys:any[][] = cartesianProductAny.filter((i:any[]) => i.length > 0); +const allCartesianProductAnys:any[][] = cartesianProductAny.toArray(); +const cartesianProductAnysCount = cartesianProductAny.length; +const nthCartesianProductAny:any[] = cartesianProductAny.nth(3); +const cartesianProductAnyByCoords:any[] = cartesianProductAny.get(1, 1); + +const version:string = Combinatorics.VERSION; diff --git a/js-combinatorics/js-combinatorics.d.ts b/js-combinatorics/js-combinatorics.d.ts new file mode 100644 index 0000000000..270e98b641 --- /dev/null +++ b/js-combinatorics/js-combinatorics.d.ts @@ -0,0 +1,135 @@ +// Type definitions for js-combinatorics v0.5.0 +// Project: https://github.com/dankogai/js-combinatorics +// Definitions by: Vasya Aksyonov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare namespace __Combinatorics { + + interface IGenerator { + + /** + * Returns the element or undefined if no more element is available. + */ + next():T; + + /** + * Applies the callback function for each element. + */ + forEach(f:(item:T) => void):void; + + /** + * All elements at once with function applied to each element. + */ + map(f:(item:T) => TResult):TResult[]; + + /** + * Returns an array with elements that passes the filter function. + */ + filter(predicate:(item:T) => boolean):T[]; + + /** + * All elements at once. + */ + toArray():T[]; + + /** + * Returns the number of elements to be generated which equals to generator.toArray().length + * but it is precalculated without actually generating elements. + * Handy when you prepare for large iteration. + */ + length:number; + + } + + interface IPredictableGenerator extends IGenerator { + + /** + * Returns the nth element (starting 0). + */ + nth(n:number):T; + + } + + interface ICartesianProductGenerator extends IPredictableGenerator { + + /** + * Arguments are coordinates in integer. + * Arguments can be out of bounds but it returns undefined in such cases. + */ + get(...coordinates:number[]):T; + + } + + /** + * Calculates m P n + */ + function P(m:number, n:number):number; + + /** + * Calculates m C n + */ + function C(m:number, n:number):number; + + /** + * Calculates n! + */ + function factorial(n:number):number; + + /** + * Returns the factoradic representation of n in array, in least significant order. + * See http://en.wikipedia.org/wiki/Factorial_number_system + */ + function factoradic(n:number):number[]; + + /** + * Generates the power set of array. + */ + function power(a:T[]):IPredictableGenerator; + + /** + * Generates the combination of array with n elements. + * When n is ommited, the length of the array is used. + */ + function combination(a:T[], n?:number):IGenerator; + + /** + * Generates the permutation of array with n elements. + * When n is ommited, the length of the array is used. + */ + function permutation(a:T[], n?:number):IGenerator; + + /** + * Generates the permutation of the combination of n. + * Equivalent to permutation(combination(a)), but more efficient. + */ + function permutationCombination(a:T[]):IGenerator; + + /** + * Generates n-digit "numbers" where each digit is an element in array. + * Note this "number" is in the least significant order. + * When n is ommited, the length of the array is used. + */ + function baseN(a:T[], n?:number):IPredictableGenerator; + + /** + * Generates the cartesian product of the arrays. All arguments must be arrays with more than one element. + */ + function cartesianProduct(a1:T1[]):ICartesianProductGenerator<[T1]>; + function cartesianProduct(a1:T1[], a2:T2[]):ICartesianProductGenerator<[T1, T2]>; + function cartesianProduct(a1:T1[], a2:T2[], a3:T3[]):ICartesianProductGenerator<[T1, T2, T3]>; + function cartesianProduct(a1:T1[], a2:T2[], a3:T3[], a4:T4[]):ICartesianProductGenerator<[T1, T2, T3, T4]>; + function cartesianProduct(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5]>; + function cartesianProduct(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6]>; + function cartesianProduct(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[], a7:T7[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6, T7]>; + function cartesianProduct(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[], a7:T7[], a8:T8[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6, T7, T8]>; + function cartesianProduct(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[], a7:T7[], a8:T8[], a9:T9[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; + function cartesianProduct(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[], a7:T7[], a8:T8[], a9:T9[], a10:T10[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; + function cartesianProduct(...a:any[][]):ICartesianProductGenerator; + + const VERSION:string; + +} + +declare module "js-combinatorics" { + export = __Combinatorics; +} From 211643619c5a47c2fc338a8d6ff71771a2ac1370 Mon Sep 17 00:00:00 2001 From: Vasya Aksyonov Date: Fri, 27 Nov 2015 15:25:35 +0500 Subject: [PATCH 069/107] More cartesian product typings --- js-combinatorics/js-combinatorics-global-tests.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js-combinatorics/js-combinatorics-global-tests.ts b/js-combinatorics/js-combinatorics-global-tests.ts index b8cbd3525c..e8591fbc20 100644 --- a/js-combinatorics/js-combinatorics-global-tests.ts +++ b/js-combinatorics/js-combinatorics-global-tests.ts @@ -52,6 +52,7 @@ const nthbaseN:string[] = baseN.nth(3); const cartesianProduct1 = Combinatorics.cartesianProduct(["a", "b", "c"]); const nextCartesianProduct1:[string] = cartesianProduct1.next(); +const nextCartesianProduct1Char = nextCartesianProduct1[0].substr(0, 1); cartesianProduct1.forEach((i:[string]) => console.log(i)); const cartesianProduct1sLengths:number[] = cartesianProduct1.map((i:[string]) => i.length); const filteredCartesianProduct1s:[string][] = cartesianProduct1.filter((i:[string]) => i.length > 0); @@ -62,6 +63,8 @@ const cartesianProduct1ByCoords:[string] = cartesianProduct1.get(1); const cartesianProduct2 = Combinatorics.cartesianProduct(["a", "b", "c"], [1, 2, 3]); const nextCartesianProduct2:[string, number] = cartesianProduct2.next(); +const nextCartesianProduct2Char = nextCartesianProduct2[0].substr(0, 1); +const nextCartesianProduct2Num = nextCartesianProduct2[1].toFixed(2); cartesianProduct2.forEach((i:[string, number]) => console.log(i)); const cartesianProduct2sLengths:number[] = cartesianProduct2.map((i:[string, number]) => i.length); const filteredCartesianProduct2s:[string, number][] = cartesianProduct2.filter((i:[string, number]) => i.length > 0); @@ -72,6 +75,9 @@ const cartesianProduct2ByCoords:[string, number] = cartesianProduct2.get(1, 1); const cartesianProduct3 = Combinatorics.cartesianProduct(["a", "b", "c"], [1, 2, 3], [true, false]); const nextCartesianProduct3:[string, number, boolean] = cartesianProduct3.next(); +const nextCartesianProduct3Char = nextCartesianProduct3[0].substr(0, 1); +const nextCartesianProduct3Num = nextCartesianProduct3[1].toFixed(2); +const nextCartesianProduct4Cond = nextCartesianProduct3[2] === true; cartesianProduct3.forEach((i:[string, number, boolean]) => console.log(i)); const cartesianProduct3sLengths:number[] = cartesianProduct3.map((i:[string, number, boolean]) => i.length); const filteredCartesianProduct3s:[string, number, boolean][] = cartesianProduct3.filter((i:[string, number, boolean]) => i.length > 0); @@ -90,4 +96,4 @@ const cartesianProductAnysCount = cartesianProductAny.length; const nthCartesianProductAny:any[] = cartesianProductAny.nth(3); const cartesianProductAnyByCoords:any[] = cartesianProductAny.get(1, 1); -const version:string = Combinatorics.VERSION; \ No newline at end of file +const version:string = Combinatorics.VERSION; From 0dd5ad7c0f031515546c90aa1faf06054c46ce83 Mon Sep 17 00:00:00 2001 From: Marcin Porebski Date: Fri, 27 Nov 2015 13:44:42 +0100 Subject: [PATCH 070/107] Wreck 7.0.0 typings --- wreck/wreck-tests.ts | 41 ++++++++++++++++++++++++++++++++++++++++ wreck/wreck.d.ts | 45 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 wreck/wreck-tests.ts create mode 100644 wreck/wreck.d.ts diff --git a/wreck/wreck-tests.ts b/wreck/wreck-tests.ts new file mode 100644 index 0000000000..b1e8b0d0b1 --- /dev/null +++ b/wreck/wreck-tests.ts @@ -0,0 +1,41 @@ +/// + +import Wreck = require('wreck'); + +Wreck.get('https://google.com/', function (err, res, payload) { + /* do stuff */ +}); + + +var method = 'GET'; // GET, POST, PUT, DELETE +var uri = 'https://google.com/'; +var readableStream = Wreck.toReadableStream('foo=bar'); + +var wreck = Wreck.defaults({ + headers: { 'x-foo-bar': 123 } +}); + +// cascading example -- does not alter `wreck` +var wreckWithTimeout = wreck.defaults({ + timeout: 5 +}); + +// all attributes are optional +var options = { + maxBytes: 1048576, // 1 MB, default: unlimited + rejectUnauthorized: true, + downstreamRes: null, + agent: null, // Node Core http.Agent +}; + +var optionalCallback = function (err, res) { + + /* handle err if it exists, in which case res will be undefined */ + + // buffer the response stream + Wreck.read(res, null, function (err, body) { + /* do stuff */ + }); +}; + +var req = wreck.request(method, uri, options, optionalCallback); diff --git a/wreck/wreck.d.ts b/wreck/wreck.d.ts new file mode 100644 index 0000000000..7198de2bb4 --- /dev/null +++ b/wreck/wreck.d.ts @@ -0,0 +1,45 @@ +// Type definitions for wreck 7.0.0 +// Project: https://github.com/hapijs/wreck +// Definitions by: Marcin Porębski +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Wreck +{ + import http = require('http'); + import stream = require('stream'); + + + interface IWreckObject + { + defaults: (options: any) => IWreckObject; + + request: (method: string, uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage) => void = null) => http.ClientRequest; + + read: (response: http.IncomingMessage, options: any, callback: (err: any, payload: any) => void) => void; + + get: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; + post: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; + patch: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; + put: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; + delete: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; + + toReadableStream: (payload: any, encoding: string = null) => stream.Readable; + + parseCacheControl: (field: string) => any; + + agents: { + http: http.Agent, + https: http.Agent + }; + } + +} + +declare module "wreck" +{ + var wreck: Wreck.IWreckObject; + + export = wreck; +} From 117d429754f3f0a52ae903c3203e0a703022f488 Mon Sep 17 00:00:00 2001 From: Marcin Porebski Date: Fri, 27 Nov 2015 13:53:54 +0100 Subject: [PATCH 071/107] Wreck 7.0.0 typings - fixes --- wreck/wreck-tests.ts | 10 ++++------ wreck/wreck.d.ts | 22 +++++++++------------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/wreck/wreck-tests.ts b/wreck/wreck-tests.ts index b1e8b0d0b1..6e7abab0e5 100644 --- a/wreck/wreck-tests.ts +++ b/wreck/wreck-tests.ts @@ -2,7 +2,7 @@ import Wreck = require('wreck'); -Wreck.get('https://google.com/', function (err, res, payload) { +Wreck.get('https://google.com/', {}, function (err: any, res: any, payload: any) { /* do stuff */ }); @@ -23,17 +23,15 @@ var wreckWithTimeout = wreck.defaults({ // all attributes are optional var options = { maxBytes: 1048576, // 1 MB, default: unlimited - rejectUnauthorized: true, - downstreamRes: null, - agent: null, // Node Core http.Agent + rejectUnauthorized: true }; -var optionalCallback = function (err, res) { +var optionalCallback = function (err: any, res: any) { /* handle err if it exists, in which case res will be undefined */ // buffer the response stream - Wreck.read(res, null, function (err, body) { + Wreck.read(res, null, function (err: any, body: any) { /* do stuff */ }); }; diff --git a/wreck/wreck.d.ts b/wreck/wreck.d.ts index 7198de2bb4..135b2f4f2c 100644 --- a/wreck/wreck.d.ts +++ b/wreck/wreck.d.ts @@ -5,7 +5,7 @@ /// -declare module Wreck +declare module "wreck" { import http = require('http'); import stream = require('stream'); @@ -15,17 +15,17 @@ declare module Wreck { defaults: (options: any) => IWreckObject; - request: (method: string, uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage) => void = null) => http.ClientRequest; + request: (method: string, uri: string, options: any, callback?: (err: any, response: http.IncomingMessage) => void) => http.ClientRequest; read: (response: http.IncomingMessage, options: any, callback: (err: any, payload: any) => void) => void; - get: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; - post: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; - patch: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; - put: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; - delete: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest; + get: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + post: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + patch: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + put: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + delete: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; - toReadableStream: (payload: any, encoding: string = null) => stream.Readable; + toReadableStream: (payload: any, encoding?: string) => stream.Readable; parseCacheControl: (field: string) => any; @@ -35,11 +35,7 @@ declare module Wreck }; } -} - -declare module "wreck" -{ - var wreck: Wreck.IWreckObject; + var wreck: IWreckObject; export = wreck; } From 5b7b0dcf88d01d13148e16da14c28faf864cf48c Mon Sep 17 00:00:00 2001 From: Roman Krivtsov Date: Fri, 27 Nov 2015 17:22:16 +0100 Subject: [PATCH 072/107] New typings for fs-extra --- fs-extra/fs-extra.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs-extra/fs-extra.d.ts b/fs-extra/fs-extra.d.ts index 852956a71b..d997d12a89 100644 --- a/fs-extra/fs-extra.d.ts +++ b/fs-extra/fs-extra.d.ts @@ -167,6 +167,15 @@ declare module "fs-extra" { export function exists(path: string, callback?: (exists: boolean) => void ): void; export function existsSync(path: string): boolean; export function ensureDir(path: string, cb: (err: Error) => void): void; + export function ensureDirSync(path: string): void; + export function ensureFile(path: string, cb: (err: Error) => void): void; + export function ensureFileSync(path: string): void; + export function ensureLink(path: string, cb: (err: Error) => void): void; + export function ensureLinkSync(path: string): void; + export function ensureSymlink(path: string, cb: (err: Error) => void): void; + export function ensureSymlinkSync(path: string): void; + export function emptyDir(path: string, callback?: (err: Error) => void): void; + export function emptyDirSync(path: string): boolean; export interface OpenOptions { encoding?: string; @@ -192,4 +201,5 @@ declare module "fs-extra" { } export function createReadStream(path: string, options?: ReadStreamOptions): ReadStream; export function createWriteStream(path: string, options?: WriteStreamOptions): WriteStream; + export function createOutputStream(path: string, options?: WriteStreamOptions): WriteStream; } From 6d5f4d98b5a55b77f1ec0bcfad860007eaa3ee26 Mon Sep 17 00:00:00 2001 From: Roman Krivtsov Date: Fri, 27 Nov 2015 17:35:42 +0100 Subject: [PATCH 073/107] Fs-extra new typings tests --- fs-extra/fs-extra-tests.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/fs-extra/fs-extra-tests.ts b/fs-extra/fs-extra-tests.ts index 0919ef1b08..80655ab5b8 100644 --- a/fs-extra/fs-extra-tests.ts +++ b/fs-extra/fs-extra-tests.ts @@ -45,6 +45,7 @@ var openOpts: fs.OpenOptions; var watcher: fs.FSWatcher; var readStreeam: stream.Readable; var writeStream: stream.Writable; +var outputStream: stream.Writable; fs.copy(src, dest, errorCallback); fs.copy(src, dest, (src: string) => { @@ -150,7 +151,7 @@ strArr = fs.readdirSync(path); fs.close(fd, errorCallback); fs.closeSync(fd); fs.open(path, flags, modeStr, (err: Error, fd: number) => { - + }); num = fs.openSync(path, flags, modeStr); fs.utimes(path, atime, mtime, errorCallback); @@ -217,6 +218,17 @@ fs.exists(path, (exists: boolean) => { }); bool = fs.existsSync(path); +fs.ensureDir(path, errorCallback); +fs.ensureDirSync(path); +fs.ensureFile(path, errorCallback); +fs.ensureFileSync(path); +fs.ensureLink(path, errorCallback); +fs.ensureLinkSync(path); +fs.ensureSymlink(path, errorCallback); +fs.ensureSymlinkSync(path); +fs.emptyDir(path, errorCallback); +fs.emptyDirSync(path); + readStreeam = fs.createReadStream(path); readStreeam = fs.createReadStream(path, { flags: str, @@ -231,3 +243,9 @@ writeStream = fs.createWriteStream(path, { encoding: str, string: str }); +outputStream = fs.createOutputStream(path); +outputStream = fs.createOutputStream(path, { + flags: str, + encoding: str, + string: str +}); From 814e5ba4b19295c427df103ce4bf20857853f82d Mon Sep 17 00:00:00 2001 From: Michael Tiller Date: Fri, 27 Nov 2015 11:27:26 -0500 Subject: [PATCH 074/107] Exposing additional types and interfaces --- react-router/react-router.d.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 7063d2ab66..2010a1f496 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -310,6 +310,11 @@ declare module "react-router/lib/useRoutes" { } +declare module "react-router/lib/PatternUtils" { + + export function formatPattern(pattern: string, params: {}): string; + +} declare module "react-router/lib/RouteUtils" { @@ -396,12 +401,33 @@ declare module "react-router" { import { createRoutes } from "react-router/lib/RouteUtils" + import { formatPattern } from "react-router/lib/PatternUtils" + import RoutingContext from "react-router/lib/RoutingContext" import PropTypes from "react-router/lib/PropTypes" import match from "react-router/lib/match" + // PlainRoute is defined in the API documented at: + // https://github.com/rackt/react-router/blob/master/docs/API.md + // but not included in any of the .../lib modules above. + export type PlainRoute = ReactRouter.PlainRoute + + // The following definitions are also very useful to export + // because by using these types lots of potential type errors + // can be exposed: + export type EnterHook = ReactRouter.EnterHook + export type LeaveHook = ReactRouter.LeaveHook + export type ParseQueryString = ReactRouter.ParseQueryString + export type RedirectFunction = ReactRouter.RedirectFunction + export type RouteComponentProps = ReactRouter.RouteComponentProps; + export type RouteHook = ReactRouter.RouteHook + export type StringifyQuery = ReactRouter.StringifyQuery + export type RouterListener = ReactRouter.RouterListener + export type RouterState = ReactRouter.RouterState + export type HistoryBase = ReactRouter.HistoryBase + export { Router, Link, @@ -415,6 +441,7 @@ declare module "react-router" { RouteContext, useRoutes, createRoutes, + formatPattern, RoutingContext, PropTypes, match From ad6c1fad6c37533530e7f2d3852ae606f3cea767 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sat, 28 Nov 2015 02:42:35 +0900 Subject: [PATCH 075/107] Add ratelimtier.d.ts --- ratelimiter/ratelimiter-tests.ts | 17 +++++++++ ratelimiter/ratelimiter.d.ts | 59 ++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 ratelimiter/ratelimiter-tests.ts create mode 100644 ratelimiter/ratelimiter.d.ts diff --git a/ratelimiter/ratelimiter-tests.ts b/ratelimiter/ratelimiter-tests.ts new file mode 100644 index 0000000000..14d42422e0 --- /dev/null +++ b/ratelimiter/ratelimiter-tests.ts @@ -0,0 +1,17 @@ +/// +/// + +import redis = require('redis'); +import Limiter = require('ratelimiter'); + +let id: string; +let db: redis.RedisClient; +let limit = new Limiter({ id: id, db: db }); + +const str: string = limit.inspect(); + +limit.get((err, limit): void => { + const total: number = limit.total; + const remaining: number = limit.remaining; + const reset: number = limit.reset; +}); diff --git a/ratelimiter/ratelimiter.d.ts b/ratelimiter/ratelimiter.d.ts new file mode 100644 index 0000000000..6e9883dd53 --- /dev/null +++ b/ratelimiter/ratelimiter.d.ts @@ -0,0 +1,59 @@ +// Type definitions for ratelimiter 2.1.1 +// Project: https://github.com/tj/node-ratelimiter +// Definitions by: Aya Morisawa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "ratelimiter" { + import { RedisClient } from 'redis'; + + interface LimiterOption { + /** + * The identifier to limit against (typically a user id) + */ + id: string; + + /** + * Redis connection instance + */ + db: RedisClient; + + /** + * Max requests within duration + */ + max?: number; + + /** + * Duration of limit in milliseconds + */ + duration?: number; + } + + interface LimiterInfo { + /** + * max value + */ + total: number; + + /** + * Number of calls left in current duration without decreasing current get + */ + remaining: number; + + /** + * Time in milliseconds until the end of current duration + */ + reset: number; + } + + class Limiter { + constructor(opts: LimiterOption); + + inspect(): string; + + get(fn: (err: any, info: LimiterInfo) => void): void; + } + + export = Limiter; +} From 44c617ff731e8fc62ae2fc689126b12aa7c13a32 Mon Sep 17 00:00:00 2001 From: cherrydev Date: Fri, 27 Nov 2015 16:33:58 -0800 Subject: [PATCH 076/107] Update dexie.d.ts ; Add semicolons to quell errors Some TS editors are complaining about a few missing semicolons. --- dexie/dexie.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dexie/dexie.d.ts b/dexie/dexie.d.ts index d6c26283c2..13b9b31e0b 100644 --- a/dexie/dexie.d.ts +++ b/dexie/dexie.d.ts @@ -38,7 +38,7 @@ declare class Dexie { static deepClone(obj: Object): Object; - version(versionNumber: number): Dexie.Version + version(versionNumber: number): Dexie.Version; on: { (eventName: string, subscriber: () => any): void; @@ -48,7 +48,7 @@ declare class Dexie { populate: Dexie.DexieEvent; blocked: Dexie.DexieEvent; versionchange: Dexie.DexieVersionChangeEvent; - } + }; open(): Dexie.Promise; From 2acc0fe641631c727d91fa20ff73f52ed54ee2b0 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 28 Nov 2015 09:36:59 +0500 Subject: [PATCH 077/107] lodash: signatures of _.isNull have been changed --- lodash/lodash-tests.ts | 23 +++++++++++++++++++---- lodash/lodash.d.ts | 10 +++++++++- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bdc08ccdc7..af4f246c58 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5092,10 +5092,25 @@ result = _(Array.prototype.push).isNative(); } // _.isNull -result = _.isNull(any); -result = _(1).isNull(); -result = _([]).isNull(); -result = _({}).isNull(); +module TestIsNull { + { + let result: boolean; + + result = _.isNull(any); + + result = _(1).isNull(); + result = _([]).isNull(); + result = _({}).isNull(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNull(); + result = _([]).chain().isNull(); + result = _({}).chain().isNull(); + } +} // _.isNumber result = _.isNumber(any); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ad465c5c39..e6da5f334e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8919,9 +8919,10 @@ declare module _ { interface LoDashStatic { /** * Checks if value is null. + * * @param value The value to check. * @return Returns true if value is null, else false. - **/ + */ isNull(value?: any): boolean; } @@ -8932,6 +8933,13 @@ declare module _ { isNull(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * see _.isNull + */ + isNull(): LoDashExplicitWrapper; + } + //_.isNumber interface LoDashStatic { /** From bc664db5212182aa61ee6fb1b3935bc1ffbd29dc Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 28 Nov 2015 10:00:09 +0500 Subject: [PATCH 078/107] lodash: signatures of _.defer have been changed --- lodash/lodash-tests.ts | 35 +++++++++++++++++++++++++++++++++-- lodash/lodash.d.ts | 31 ++++++++++++++++++++----------- 2 files changed, 53 insertions(+), 13 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bdc08ccdc7..7a477f585b 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4490,8 +4490,39 @@ source.addEventListener('message', <_.LoDashImplicitObjectWrapper>_(fu var returnedDebounce = _.throttle(function (a: any) { return a * 5; }, 5); returnedThrottled(4); -result = _.defer(function () { console.log('deferred'); }); -result = <_.LoDashImplicitWrapper>_(function () { console.log('deferred'); }).defer(); +// _.defer +module TestDefer { + type SampleFunc = (a: number, b: string) => boolean; + + let func: SampleFunc; + + { + let result: number; + + result = _.defer(func); + result = _.defer(func, any); + result = _.defer(func, any, any); + result = _.defer(func, any, any, any); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(func).defer(); + result = _(func).defer(any); + result = _(func).defer(any, any); + result = _(func).defer(any, any, any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(func).chain().defer(); + result = _(func).chain().defer(any); + result = _(func).chain().defer(any, any); + result = _(func).chain().defer(any, any, any); + } +} // _.delay module TestDelay { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ad465c5c39..23c1ae4f2e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -7913,24 +7913,33 @@ declare module _ { //_.defer interface LoDashStatic { /** - * Defers executing the func function until the current call stack has cleared. Additional - * arguments will be provided to func when it is invoked. - * @param func The function to defer. - * @param args Arguments to invoke the function with. - * @return The timer id. - **/ - defer( - func: Function, - ...args: any[]): number; + * Defers invoking the func until the current call stack has cleared. Any additional arguments are provided to + * func when it’s invoked. + * + * @param func The function to defer. + * @param args The arguments to invoke the function with. + * @return Returns the timer id. + */ + defer( + func: T, + ...args: any[] + ): number; } interface LoDashImplicitObjectWrapper { /** - * @see _.defer - **/ + * @see _.defer + */ defer(...args: any[]): LoDashImplicitWrapper; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.defer + */ + defer(...args: any[]): LoDashExplicitWrapper; + } + //_.delay interface LoDashStatic { /** From 496bca81b7c6cdf81b8245a3cb029b58295d5d5c Mon Sep 17 00:00:00 2001 From: Joe Skeen Date: Sat, 28 Nov 2015 10:59:30 -0700 Subject: [PATCH 079/107] comment formatting --- adm-zip/adm-zip.d.ts | 72 ++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/adm-zip/adm-zip.d.ts b/adm-zip/adm-zip.d.ts index ee57569dac..208c13b27b 100644 --- a/adm-zip/adm-zip.d.ts +++ b/adm-zip/adm-zip.d.ts @@ -227,70 +227,70 @@ declare module "adm-zip" { module AdmZip { /** - * The ZipEntry is more than a structure representing the entry inside the - * zip file. Beside the normal attributes and headers a entry can have, the - * class contains a reference to the part of the file where the compressed - * data resides and decompresses it when requested. It also compresses the - * data and creates the headers required to write in the zip file. - */ + * The ZipEntry is more than a structure representing the entry inside the + * zip file. Beside the normal attributes and headers a entry can have, the + * class contains a reference to the part of the file where the compressed + * data resides and decompresses it when requested. It also compresses the + * data and creates the headers required to write in the zip file. + */ interface IZipEntry { /** - * Represents the full name and path of the file - */ + * Represents the full name and path of the file + */ entryName: string; rawEntryName: Buffer; /** - * Extra data associated with this entry. - */ + * Extra data associated with this entry. + */ extra: Buffer; /** - * Entry comment. - */ + * Entry comment. + */ comment: string; name: string; /** - * Read-Only property that indicates the type of the entry. - */ + * Read-Only property that indicates the type of the entry. + */ isDirectory: boolean; /** - * Get the header associated with this ZipEntry. - */ + * Get the header associated with this ZipEntry. + */ header: Buffer; /** - * Retrieve the compressed data for this entry. Note that this may trigger - * compression if any properties were modified. - */ + * Retrieve the compressed data for this entry. Note that this may trigger + * compression if any properties were modified. + */ getCompressedData(): Buffer; /** - * Asynchronously retrieve the compressed data for this entry. Note that - * this may trigger compression if any properties were modified. - */ + * Asynchronously retrieve the compressed data for this entry. Note that + * this may trigger compression if any properties were modified. + */ getCompressedDataAsync(callback: (data: Buffer) => void): void; /** - * Set the (uncompressed) data to be associated with this entry. - */ + * Set the (uncompressed) data to be associated with this entry. + */ setData(value: string): void; /** - * Set the (uncompressed) data to be associated with this entry. - */ + * Set the (uncompressed) data to be associated with this entry. + */ setData(value: Buffer): void; /** - * Get the decompressed data associated with this entry. - */ + * Get the decompressed data associated with this entry. + */ getData(): Buffer; /** - * Asynchronously get the decompressed data associated with this entry. - */ + * Asynchronously get the decompressed data associated with this entry. + */ getDataAsync(callback: (data: Buffer) => void): void; /** - * Returns the CEN Entry Header to be written to the output zip file, plus - * the extra data and the entry comment. - */ + * Returns the CEN Entry Header to be written to the output zip file, plus + * the extra data and the entry comment. + */ packHeader(): Buffer; /** - * Returns a nicely formatted string with the most important properties of - * the ZipEntry. - */ + * Returns a nicely formatted string with the most important properties of + * the ZipEntry. + */ toString(): string; } } From e2e1e881bb57431fbbe9289ac4da1fea928dc84c Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Sun, 29 Nov 2015 00:28:28 +0200 Subject: [PATCH 080/107] jwt-decode definition file added --- jwt-decode/jwt-decode.d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 jwt-decode/jwt-decode.d.ts diff --git a/jwt-decode/jwt-decode.d.ts b/jwt-decode/jwt-decode.d.ts new file mode 100644 index 0000000000..67d7aac163 --- /dev/null +++ b/jwt-decode/jwt-decode.d.ts @@ -0,0 +1,16 @@ +// Type definitions for jwt-decode v1.4.0 +// Project: https://github.com/auth0/jwt-decode +// Definitions by: Giedrius Grabauskas +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module JwtDecode { + interface JwtDecodeStatic { + (token: string): any; + } +} + +declare module 'jwt-decode' { + var jwtDecode: JwtDecode.JwtDecodeStatic; + export = jwtDecode; +} From 0edde72be8d59eaff8775a8ba992a43dbf2dccc0 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Sun, 29 Nov 2015 00:31:26 +0200 Subject: [PATCH 081/107] jwt-decode test added --- jwt-decode/jwt-decode-test.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 jwt-decode/jwt-decode-test.ts diff --git a/jwt-decode/jwt-decode-test.ts b/jwt-decode/jwt-decode-test.ts new file mode 100644 index 0000000000..231c3d3007 --- /dev/null +++ b/jwt-decode/jwt-decode-test.ts @@ -0,0 +1,5 @@ +import * as jwtDecode from 'jwt-decode'; + +let token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmb28iOiJiYXIiLCJleHAiOjEzOTMyODY4OTMsImlhdCI6MTM5MzI2ODg5M30.4-iaDojEVl0pJQMjrbM1EzUIfAZgsbK_kgnVyVxFSVo"; + +let decodedToken = jwtDecode(responseIdToken); From bf04904b971185574aed5ad599505a6cacd49816 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Sun, 29 Nov 2015 00:37:54 +0200 Subject: [PATCH 082/107] jwt-decode tests added --- jwt-decode/{jwt-decode-test.ts => jwt-decode-tests.ts} | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) rename jwt-decode/{jwt-decode-test.ts => jwt-decode-tests.ts} (63%) diff --git a/jwt-decode/jwt-decode-test.ts b/jwt-decode/jwt-decode-tests.ts similarity index 63% rename from jwt-decode/jwt-decode-test.ts rename to jwt-decode/jwt-decode-tests.ts index 231c3d3007..fcecd326ac 100644 --- a/jwt-decode/jwt-decode-test.ts +++ b/jwt-decode/jwt-decode-tests.ts @@ -2,4 +2,10 @@ import * as jwtDecode from 'jwt-decode'; let token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmb28iOiJiYXIiLCJleHAiOjEzOTMyODY4OTMsImlhdCI6MTM5MzI2ODg5M30.4-iaDojEVl0pJQMjrbM1EzUIfAZgsbK_kgnVyVxFSVo"; -let decodedToken = jwtDecode(responseIdToken); +interface TokenDto { + foo: string; + exp: number; + iat: number; +} + +let decodedToken = jwtDecode(token) as TokenDto; From 95f6be561df5a420c69b408f50c10ea53ea76cc6 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Sun, 29 Nov 2015 00:50:23 +0200 Subject: [PATCH 083/107] Fixed jwtDecode import. --- jwt-decode/jwt-decode-tests.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jwt-decode/jwt-decode-tests.ts b/jwt-decode/jwt-decode-tests.ts index fcecd326ac..66d639b409 100644 --- a/jwt-decode/jwt-decode-tests.ts +++ b/jwt-decode/jwt-decode-tests.ts @@ -1,5 +1,6 @@ -import * as jwtDecode from 'jwt-decode'; - + /// +import jwtDecode = require('jwt-decode'); + let token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmb28iOiJiYXIiLCJleHAiOjEzOTMyODY4OTMsImlhdCI6MTM5MzI2ODg5M30.4-iaDojEVl0pJQMjrbM1EzUIfAZgsbK_kgnVyVxFSVo"; interface TokenDto { From b9d1b538d5b115b4eba2e4cbe019568b23c6cf2c Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sun, 29 Nov 2015 04:51:06 +0500 Subject: [PATCH 084/107] A definition of module "buffer-compare" has been added --- buffer-compare/buffer-compare-tests.ts | 27 ++++++++++++++++++++++++++ buffer-compare/buffer-compare.d.ts | 17 ++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 buffer-compare/buffer-compare-tests.ts create mode 100644 buffer-compare/buffer-compare.d.ts diff --git a/buffer-compare/buffer-compare-tests.ts b/buffer-compare/buffer-compare-tests.ts new file mode 100644 index 0000000000..88e6dddb94 --- /dev/null +++ b/buffer-compare/buffer-compare-tests.ts @@ -0,0 +1,27 @@ +/// +/// + +import compare = require('buffer-compare'); + +let result: number; + +result = compare(new Buffer(''), new Buffer('')); +result = compare([], []); +result = compare('', ''); +result = compare(new Buffer(''), []); +result = compare([], ''); +result = compare('', new Buffer('')); + +result = compare(new Buffer(''), new Buffer('')); +result = compare([], []); +result = compare('', ''); +result = compare(new Buffer(''), []); +result = compare([], ''); +result = compare('', new Buffer('')); + +result = compare(new Buffer(''), new Buffer('')); +result = compare([], []); +result = compare('', ''); +result = compare(new Buffer(''), []); +result = compare([], ''); +result = compare('', new Buffer('')); diff --git a/buffer-compare/buffer-compare.d.ts b/buffer-compare/buffer-compare.d.ts new file mode 100644 index 0000000000..58e4004dcb --- /dev/null +++ b/buffer-compare/buffer-compare.d.ts @@ -0,0 +1,17 @@ +// Type definitions for buffer-compare +// Project: https://github.com/soldair/node-buffer-compare +// Definitions by: Ilya Mochalov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "buffer-compare" { + interface List { + [index: number]: any; + length: number + } + + function compare(cmp: List, to: List): number; + function compare(cmp: T, to: T): number; + function compare(cmp: C, to: T): number; + + export = compare; +} From 6153dcb3010d9661fe2e038d91ae440859b5364c Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sun, 29 Nov 2015 07:38:27 +0500 Subject: [PATCH 085/107] lodash: signatures of _.invert have been changed --- lodash/lodash-tests.ts | 30 ++++++++++++++++++++++++------ lodash/lodash.d.ts | 20 +++++++++++++++++++- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bdc08ccdc7..3563bc9907 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6399,12 +6399,30 @@ module TestHas { } // _.invert -{ - let result: TResult; - result = _.invert({}); - result = _.invert({}, true); - result = _({}).invert().value(); - result = _({}).invert(true).value(); +module TestInvert { + { + let result: TResult; + + result = _.invert({}); + result = _.invert({}, true); + + result = _.invert({}); + result = _.invert({}, true); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).invert(); + result = _({}).invert(true); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().invert(); + result = _({}).chain().invert(true); + } } // _.keys diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ad465c5c39..dd266bba7a 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10823,7 +10823,18 @@ declare module _ { * @param multiValue Allow multiple values per key. * @return Returns the new inverted object. */ - invert(object: T, multiValue?: boolean): TResult; + invert( + object: T, + multiValue?: boolean + ): TResult; + + /** + * @see _.invert + */ + invert( + object: Object, + multiValue?: boolean + ): TResult; } interface LoDashImplicitObjectWrapper { @@ -10833,6 +10844,13 @@ declare module _ { invert(multiValue?: boolean): LoDashImplicitObjectWrapper; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.invert + */ + invert(multiValue?: boolean): LoDashExplicitObjectWrapper; + } + //_.keys interface LoDashStatic { /** From c59dcb8d6f88e858ceb6dd72dd1a0325dc580d47 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Mon, 30 Nov 2015 09:48:26 +0500 Subject: [PATCH 086/107] lodash: signatures of _.sortedIndex have been changed --- lodash/lodash-tests.ts | 91 +++++++++++++-- lodash/lodash.d.ts | 253 +++++++++++++++++++++++++++++++++-------- 2 files changed, 284 insertions(+), 60 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bdc08ccdc7..d48362b626 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1164,17 +1164,86 @@ module TestSlice { // _.sortedIndex module TestSortedIndex { - result = _.sortedIndex([20, 30, 50], 40); - result = _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); - var sortedIndexDict: { wordToNumber: { [idx: string]: number } } = { - 'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 } - }; - result = _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function (word: string) { - return sortedIndexDict.wordToNumber[word]; - }); - result = _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function (word: string) { - return this.wordToNumber[word]; - }, sortedIndexDict); + type SampleType = {a: number; b: string; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + + let value: SampleType; + + let stringIterator: (x: string) => number; + let arrayIterator: (x: SampleType) => number; + let listIterator: (x: SampleType) => number; + + { + let result: number; + + result = _.sortedIndex('', ''); + result = _.sortedIndex('', '', stringIterator); + result = _.sortedIndex('', '', stringIterator, any); + result = _.sortedIndex('', '', stringIterator); + result = _.sortedIndex('', '', stringIterator, any); + + result = _.sortedIndex(array, value); + result = _.sortedIndex(array, value, arrayIterator); + result = _.sortedIndex(array, value, arrayIterator, any); + result = _.sortedIndex(array, value, ''); + result = _.sortedIndex(array, value, {a: 42}); + result = _.sortedIndex(array, value, arrayIterator); + result = _.sortedIndex(array, value, arrayIterator, any); + result = _.sortedIndex<{a: number}, SampleType>(array, value, {a: 42}); + + result = _.sortedIndex(list, value); + result = _.sortedIndex(list, value, listIterator); + result = _.sortedIndex(list, value, listIterator, any); + result = _.sortedIndex(list, value, ''); + result = _.sortedIndex(list, value, {a: 42}); + result = _.sortedIndex(list, value, listIterator); + result = _.sortedIndex(list, value, listIterator, any); + result = _.sortedIndex<{a: number}, SampleType>(list, value, {a: 42}); + + result = _('').sortedIndex(''); + result = _('').sortedIndex('', stringIterator); + result = _('').sortedIndex('', stringIterator, any); + + result = _(array).sortedIndex(value); + result = _(array).sortedIndex(value, arrayIterator); + result = _(array).sortedIndex(value, arrayIterator, any); + result = _(array).sortedIndex(value, ''); + result = _(array).sortedIndex<{a: number}>(value, {a: 42}); + + result = _(list).sortedIndex(value); + result = _(list).sortedIndex(value, listIterator); + result = _(list).sortedIndex(value, listIterator, any); + result = _(list).sortedIndex(value, ''); + result = _(list).sortedIndex(value, {a: 42}); + result = _(list).sortedIndex(value, listIterator); + result = _(list).sortedIndex(value, listIterator, any); + result = _(list).sortedIndex<{a: number}, SampleType>(value, {a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('').chain().sortedIndex(''); + result = _('').chain().sortedIndex('', stringIterator); + result = _('').chain().sortedIndex('', stringIterator, any); + + result = _(array).chain().sortedIndex(value); + result = _(array).chain().sortedIndex(value, arrayIterator); + result = _(array).chain().sortedIndex(value, arrayIterator, any); + result = _(array).chain().sortedIndex(value, ''); + result = _(array).chain().sortedIndex<{a: number}>(value, {a: 42}); + + result = _(list).chain().sortedIndex(value); + result = _(list).chain().sortedIndex(value, listIterator); + result = _(list).chain().sortedIndex(value, listIterator, any); + result = _(list).chain().sortedIndex(value, ''); + result = _(list).chain().sortedIndex(value, {a: 42}); + result = _(list).chain().sortedIndex(value, listIterator); + result = _(list).chain().sortedIndex(value, listIterator, any); + result = _(list).chain().sortedIndex<{a: number}, SampleType>(value, {a: 42}); + } } // _.sortedLastIndex diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ad465c5c39..5af03703ad 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1842,71 +1842,226 @@ declare module _ { //_.sortedIndex interface LoDashStatic { /** - * Uses a binary search to determine the smallest index at which a value should be inserted - * into a given sorted array in order to maintain the sort order of the array. If a callback - * is provided it will be executed for value and each element of array to compute their sort - * ranking. The callback is bound to thisArg and invoked with one argument; (value). - * - * If a property name is provided for callback the created "_.pluck" style callback will - * return the property value of the given element. - * - * If an object is provided for callback the created "_.where" style callback will return - * true for elements that have the properties of the given object, else false. - * @param array The sorted list. - * @param value The value to determine its index within `list`. - * @param callback Iterator to compute the sort ranking of each value, optional. - * @return The index at which value should be inserted into array. - **/ - sortedIndex( - array: Array, - value: T, - callback?: (x: T) => TSort, - thisArg?: any): number; - - /** - * @see _.sortedIndex - **/ + * Uses a binary search to determine the lowest index at which value should be inserted into array in order to maintain its sort order. If an iteratee function is provided it’s invoked for value and each element of array to compute their sort ranking. The iteratee is bound to thisArg and invoked with one argument; (value). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that have the properties of the given object, else false. + * + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param iteratee The function invoked per iteration. + * @return The this binding of iteratee. + */ sortedIndex( array: List, value: T, - callback?: (x: T) => TSort, - thisArg?: any): number; + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; /** - * @see _.sortedIndex - * @param pluckValue the _.pluck style callback - **/ - sortedIndex( - array: Array, - value: T, - pluckValue: string): number; - - /** - * @see _.sortedIndex - * @param pluckValue the _.pluck style callback - **/ + * @see _.sortedIndex + */ sortedIndex( array: List, value: T, - pluckValue: string): number; + iteratee?: (x: T) => any, + thisArg?: any + ): number; /** - * @see _.sortedIndex - * @param pluckValue the _.where style callback - **/ - sortedIndex( - array: Array, + * @see _.sortedIndex + */ + sortedIndex( + array: List, value: T, - whereValue: W): number; + iteratee: string + ): number; /** - * @see _.sortedIndex - * @param pluckValue the _.where style callback - **/ + * @see _.sortedIndex + */ sortedIndex( array: List, value: T, - whereValue: W): number; + iteratee: W + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee: Object + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: Object + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: Object + ): LoDashExplicitWrapper; } //_.sortedLastIndex From beea5fcbc17c0b112b64b7759fb58779189fd687 Mon Sep 17 00:00:00 2001 From: chrmcg Date: Mon, 30 Nov 2015 02:43:33 -0500 Subject: [PATCH 087/107] Add two missing semicolons --- googlemaps/google.maps.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 298f2f6ea6..3ac35b0482 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -849,7 +849,7 @@ declare module google.maps { formatted_address: string; geometry: GeocoderGeometry; partial_match: boolean; - postcode_localities: string[] + postcode_localities: string[]; types: string[]; } @@ -1822,7 +1822,7 @@ declare module google.maps { matched_substrings: PredictionSubstring[]; place_id: string; terms: PredictionTerm[]; - types: string[] + types: string[]; } export interface PredictionTerm { From e986301426bf3bed3aad75ec943b4a717f52ab73 Mon Sep 17 00:00:00 2001 From: Dominic Collart Date: Mon, 30 Nov 2015 11:13:09 +0100 Subject: [PATCH 088/107] Allow "tokenGetter" function to use many parameters (useful to load service/provider/factory) --- angular-jwt/angular-jwt.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-jwt/angular-jwt.d.ts b/angular-jwt/angular-jwt.d.ts index 55bb3e4f6a..620fcc8e4c 100644 --- a/angular-jwt/angular-jwt.d.ts +++ b/angular-jwt/angular-jwt.d.ts @@ -25,6 +25,6 @@ declare module angular.jwt { } interface IJwtInterceptor { - tokenGetter(): string; + tokenGetter(...params : any[]): string; } } From b8622c4b93b0202f19bf48043ac1c1e5890dd0fd Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Fri, 20 Nov 2015 11:12:53 -0500 Subject: [PATCH 089/107] Updating Hapi's IServerInject --- hapi/hapi.d.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 7f2fab90e6..23db494465 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -904,15 +904,25 @@ declare module "hapi" { url: string; /** an object with optional request headers where each key is the header name and the value is the header content. Defaults to no additions to the default Shot headers.*/ headers: IDictionary; - /**- an optional string or buffer containing the request payload (object must be manually converted to a string first). Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/ - payload: string|Buffer; - /**an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/ - credentials: any; + /** n optional string, buffer or object containing the request payload. In case of an object it will be converted to a string for you. Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/ + payload?: string|{}|Buffer; + /** an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/ + credentials?: any; + /** an optional artifacts object containing authentication artifact information. The artifacts are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Ignored if set without credentials. Defaults to no artifacts.*/ + artifacts?: any; + /** sets the initial value of request.app*/ + app?: any; + /** sets the initial value of request.plugins*/ + plugins?: any; + /** allows access to routes with config.isInternal set to true. Defaults to false.*/ + allowInternals?: boolean; + /** sets the remote address for the incoming connection.*/ + remoteAddress?: boolean; /**object with options used to simulate client request stream conditions for testing: error - if true, emits an 'error' event after payload transmission (if any). Defaults to false. close - if true, emits a 'close' event after payload transmission (if any). Defaults to false. end - if false, does not end the stream. Defaults to true.*/ - simulate: { + simulate?: { error: boolean; close: boolean; end: boolean; From 1c5ba17bf0d7e95d9164582509c69e4eff491251 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Fri, 20 Nov 2015 11:20:49 -0500 Subject: [PATCH 090/107] Headers is also optional --- hapi/hapi.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 23db494465..8fd84de08f 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -903,7 +903,7 @@ declare module "hapi" { /** the request URL. If the URI includes an authority (e.g. 'example.com:8080'), it is used to automatically set an HTTP 'Host' header, unless one was specified in headers.*/ url: string; /** an object with optional request headers where each key is the header name and the value is the header content. Defaults to no additions to the default Shot headers.*/ - headers: IDictionary; + headers?: IDictionary; /** n optional string, buffer or object containing the request payload. In case of an object it will be converted to a string for you. Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/ payload?: string|{}|Buffer; /** an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/ From 59e1cd247aa0509666f3bbdbff318ca20e27de5f Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Fri, 20 Nov 2015 11:48:28 -0500 Subject: [PATCH 091/107] Options could be a string --- hapi/hapi.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 8fd84de08f..727bada75b 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -897,7 +897,7 @@ declare module "hapi" { export interface IServerInject { - (options: { + (options: string | { /** the request HTTP method (e.g. 'POST'). Defaults to 'GET'.*/ method: string; /** the request URL. If the URI includes an authority (e.g. 'example.com:8080'), it is used to automatically set an HTTP 'Host' header, unless one was specified in headers.*/ From 088b384ad6d5897529d43934ded1d8c43a7a6b94 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 23 Nov 2015 09:17:32 -0500 Subject: [PATCH 092/107] Hapi does not use bluebird --- hapi/hapi.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 727bada75b..644f07e090 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -7,7 +7,7 @@ /// -/// +/// From 88d8553e62a0b552ac70aaf8cd1f844463b9eb52 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 30 Nov 2015 09:38:59 -0500 Subject: [PATCH 093/107] Adding duck typed Promise Interface --- hapi/hapi.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 644f07e090..fe9e17b5b5 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -7,10 +7,6 @@ /// -/// - - - declare module "hapi" { import http = require("http"); @@ -21,6 +17,10 @@ declare module "hapi" { [key: string]: T; } + interface IPromise { + + } + /** Boom Module for errors. https://github.com/hapijs/boom * boom provides a set of utilities for returning HTTP errors. Each utility returns a Boom error response object (instance of Error) which includes the following properties: */ export interface IBoom extends Error { @@ -234,12 +234,12 @@ declare module "hapi" { When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */ export interface IReply { (err: Error, - result?: string|number|boolean|Buffer|stream.Stream | Promise | T, + result?: string|number|boolean|Buffer|stream.Stream | IPromise | T, /** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */ credentialData?: any ): IBoom; /** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */ - (result: string|number|boolean|Buffer|stream.Stream | Promise | T): Response; + (result: string|number|boolean|Buffer|stream.Stream | IPromise | T): Response; /** Returns control back to the framework without setting a response. If called in the handler, the response defaults to an empty payload with status code 200. * The data argument is only used for passing back authentication data and is ignored elsewhere. */ From a767b1466cbe07b3065bfa9c0bf1cbe2b05578ab Mon Sep 17 00:00:00 2001 From: Daniel Gruber Date: Mon, 30 Nov 2015 16:01:59 +0100 Subject: [PATCH 094/107] added option pane --- leaflet-label/leaflet-label.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/leaflet-label/leaflet-label.d.ts b/leaflet-label/leaflet-label.d.ts index a77def73c0..02d94a3214 100644 --- a/leaflet-label/leaflet-label.d.ts +++ b/leaflet-label/leaflet-label.d.ts @@ -56,6 +56,7 @@ declare module L { className?: string; clickable?: boolean; direction?: string; // 'left' | 'right' | 'auto'; + pane?: string; noHide?: boolean; offset?: Point; opacity?: number; From af9d89e7251afc795f4ed6aa37eeb27a8971231b Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 30 Nov 2015 11:51:47 -0500 Subject: [PATCH 095/107] Basing the duck typed Promise interface on es6 --- hapi/hapi.d.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index fe9e17b5b5..b31c24b163 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -17,8 +17,15 @@ declare module "hapi" { [key: string]: T; } - interface IPromise { + interface IThenable { + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IThenable; + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IThenable; + } + interface IPromise extends IThenable { + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IPromise; + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IPromise; + catch(onRejected?: (error: any) => U | IThenable): IPromise; } /** Boom Module for errors. https://github.com/hapijs/boom From 6ffb4bca1df52db232db2d7ae42925bab79fcfd8 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 1 Dec 2015 05:15:56 +0500 Subject: [PATCH 096/107] lodash: signatures of _.groupBy have been changed --- lodash/lodash-tests.ts | 157 ++++++++++++++++++-- lodash/lodash.d.ts | 321 ++++++++++++++++++++++++++++------------- 2 files changed, 369 insertions(+), 109 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bdc08ccdc7..428f38fbdd 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -3396,21 +3396,154 @@ module TestForEachRight { } } -result = <_.Dictionary>_.groupBy([4.2, 6.1, 6.4], function (num) { return Math.floor(num); }); -result = <_.Dictionary>_.groupBy([4.2, 6.1, 6.4], function (num) { return this.floor(num); }, Math); -result = <_.Dictionary>_.groupBy(['one', 'two', 'three'], 'length'); +// _.groupBy +module TestGroupBy { + type SampleType = {a: number; b: string; c: boolean;}; -result = <_.Dictionary>_.groupBy({ prop1: 4.2, prop2: 6.1, prop3: 6.4}, function (num) { return Math.floor(num); }); -result = <_.Dictionary>_.groupBy({ prop1: 4.2, prop2: 6.1, prop3: 6.4}, function (num) { return this.floor(num); }, Math); -result = <_.Dictionary>_.groupBy({ prop1: 'one', prop2: 'two', prop3: 'three'}, 'length'); + let array: SampleType[]; + let list: _.List; + let dictionary: _.Dictionary; -result = <_.Dictionary>_([4.2, 6.1, 6.4]).groupBy(function (num) { return Math.floor(num); }).value(); -result = <_.Dictionary>_([4.2, 6.1, 6.4]).groupBy(function (num) { return this.floor(num); }, Math).value(); -result = <_.Dictionary>_(['one', 'two', 'three']).groupBy('length').value(); + let stringIterator: (char: string, index: number, string: string) => number; + let listIterator: (value: SampleType, index: number, collection: _.List) => number; + let dictionaryIterator: (value: SampleType, key: string, collection: _.Dictionary) => number; -result = <_.Dictionary>_({ prop1: 4.2, prop2: 6.1, prop3: 6.4}).groupBy(function (num) { return Math.floor(num); }).value(); -result = <_.Dictionary>_({ prop1: 4.2, prop2: 6.1, prop3: 6.4}).groupBy(function (num) { return this.floor(num); }, Math).value(); -result = <_.Dictionary>_({ prop1: 'one', prop2: 'two', prop3: 'three'}).groupBy('length').value(); + { + let result: _.Dictionary; + + result = _.groupBy(''); + result = _.groupBy('', stringIterator); + result = _.groupBy('', stringIterator, any); + result = _.groupBy('', stringIterator); + result = _.groupBy('', stringIterator, any); + } + + { + let result: _.Dictionary; + + result = _.groupBy(array); + result = _.groupBy(array, listIterator); + result = _.groupBy(array, listIterator, any); + result = _.groupBy(array, ''); + result = _.groupBy(array, '', any); + result = _.groupBy(array, {a: 42}); + + result = _.groupBy(array, listIterator); + result = _.groupBy(array, listIterator, any); + result = _.groupBy(array, '', true); + result = _.groupBy<{a: number}, SampleType>(array, {a: 42}); + + result = _.groupBy(list); + result = _.groupBy(list, listIterator); + result = _.groupBy(list, listIterator, any); + result = _.groupBy(list, ''); + result = _.groupBy(list, '', any); + result = _.groupBy(list, {a: 42}); + + result = _.groupBy(list, listIterator); + result = _.groupBy(list, listIterator, any); + result = _.groupBy(list, '', true); + result = _.groupBy<{a: number}, SampleType>(list, {a: 42}); + + result = _.groupBy(dictionary); + result = _.groupBy(dictionary, dictionaryIterator); + result = _.groupBy(dictionary, dictionaryIterator, any); + result = _.groupBy(dictionary, ''); + result = _.groupBy(dictionary, '', any); + result = _.groupBy(dictionary, {a: 42}); + + result = _.groupBy(dictionary, dictionaryIterator); + result = _.groupBy(dictionary, dictionaryIterator, any); + result = _.groupBy(dictionary, '', true); + result = _.groupBy<{a: number}, SampleType>(dictionary, {a: 42}); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _('').groupBy(); + result = _('').groupBy(stringIterator); + result = _('').groupBy(stringIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(array).groupBy(); + result = _(array).groupBy(listIterator); + result = _(array).groupBy(listIterator, any); + result = _(array).groupBy(''); + result = _(array).groupBy('', true); + result = _(array).groupBy<{a: number}>({a: 42}); + + result = _(list).groupBy(); + result = _(list).groupBy(listIterator); + result = _(list).groupBy(listIterator, any); + result = _(list).groupBy(''); + result = _(list).groupBy('', any); + result = _(list).groupBy({a: 42}); + + result = _(list).groupBy(listIterator); + result = _(list).groupBy(listIterator, any); + result = _(list).groupBy('', true); + result = _(list).groupBy<{a: number}, SampleType>({a: 42}); + + result = _(dictionary).groupBy(); + result = _(dictionary).groupBy(dictionaryIterator); + result = _(dictionary).groupBy(dictionaryIterator, any); + result = _(dictionary).groupBy(''); + result = _(dictionary).groupBy('', any); + result = _(dictionary).groupBy({a: 42}); + + result = _(dictionary).groupBy(dictionaryIterator); + result = _(dictionary).groupBy(dictionaryIterator, any); + result = _(dictionary).groupBy('', true); + result = _(dictionary).groupBy<{a: number}, SampleType>({a: 42}); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _('').chain().groupBy(); + result = _('').chain().groupBy(stringIterator); + result = _('').chain().groupBy(stringIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(array).chain().groupBy(); + result = _(array).chain().groupBy(listIterator); + result = _(array).chain().groupBy(listIterator, any); + result = _(array).chain().groupBy(''); + result = _(array).chain().groupBy('', true); + result = _(array).chain().groupBy<{a: number}>({a: 42}); + + result = _(list).chain().groupBy(); + result = _(list).chain().groupBy(listIterator); + result = _(list).chain().groupBy(listIterator, any); + result = _(list).chain().groupBy(''); + result = _(list).chain().groupBy('', any); + result = _(list).chain().groupBy({a: 42}); + + result = _(list).chain().groupBy(listIterator); + result = _(list).chain().groupBy(listIterator, any); + result = _(list).chain().groupBy('', true); + result = _(list).chain().groupBy<{a: number}, SampleType>({a: 42}); + + result = _(dictionary).chain().groupBy(); + result = _(dictionary).chain().groupBy(dictionaryIterator); + result = _(dictionary).chain().groupBy(dictionaryIterator, any); + result = _(dictionary).chain().groupBy(''); + result = _(dictionary).chain().groupBy('', any); + result = _(dictionary).chain().groupBy({a: 42}); + + result = _(dictionary).chain().groupBy(dictionaryIterator); + result = _(dictionary).chain().groupBy(dictionaryIterator, any); + result = _(dictionary).chain().groupBy('', true); + result = _(dictionary).chain().groupBy<{a: number}, SampleType>({a: 42}); + } +} // _.include module TestInclude { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ad465c5c39..bc47a062c4 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -5291,130 +5291,257 @@ declare module _ { //_.groupBy interface LoDashStatic { /** - * Creates an object composed of keys generated from the results of running each element - * of a collection through the callback. The corresponding value of each key is an array - * of the elements responsible for generating the key. The callback is bound to thisArg - * and invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for callback the created "_.pluck" style callback will - * return the property value of the given element. - * If an object is provided for callback the created "_.where" style callback will return - * true for elements that have the properties of the given object, else false - * @param collection The collection to iterate over. - * @param callback The function called per iteration. - * @param thisArg The this binding of callback. - * @return Returns the composed aggregate object. - **/ - groupBy( - collection: Array, - callback?: ListIterator, - thisArg?: any): Dictionary; - - /** - * @see _.groupBy - **/ - groupBy( + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is an array of the elements responsible for generating the + * key. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + groupBy( collection: List, - callback?: ListIterator, - thisArg?: any): Dictionary; + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; /** - * @see _.groupBy - * @param pluckValue _.pluck style callback - **/ + * @see _.groupBy + */ groupBy( - collection: Array, - pluckValue: string): Dictionary; + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; /** - * @see _.groupBy - * @param pluckValue _.pluck style callback - **/ - groupBy( - collection: List, - pluckValue: string): Dictionary; - - /** - * @see _.groupBy - * @param whereValue _.where style callback - **/ - groupBy( - collection: Array, - whereValue: W): Dictionary; - - /** - * @see _.groupBy - * @param whereValue _.where style callback - **/ - groupBy( - collection: List, - whereValue: W): Dictionary; - - /** - * @see _.groupBy - **/ - groupBy( + * @see _.groupBy + */ + groupBy( collection: Dictionary, - callback?: DictionaryIterator, - thisArg?: any): Dictionary; + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; /** - * @see _.groupBy - * @param pluckValue _.pluck style callback - **/ - groupBy( - collection: Dictionary, - pluckValue: string): Dictionary; + * @see _.groupBy + */ + groupBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; /** - * @see _.groupBy - * @param whereValue _.where style callback - **/ - groupBy( - collection: Dictionary, - whereValue: W): Dictionary; + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: string, + thisArg?: TValue + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: TWhere + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: Object + ): Dictionary; + } + + interface LoDashImplicitWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; } interface LoDashImplicitArrayWrapper { /** - * @see _.groupBy - **/ - groupBy( - callback: ListIterator, - thisArg?: any): _.LoDashImplicitObjectWrapper<_.Dictionary>; + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; /** - * @see _.groupBy - **/ - groupBy( - pluckValue: string): _.LoDashImplicitObjectWrapper<_.Dictionary>; + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashImplicitObjectWrapper>; /** - * @see _.groupBy - **/ - groupBy( - whereValue: W): _.LoDashImplicitObjectWrapper<_.Dictionary>; + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashImplicitObjectWrapper>; } interface LoDashImplicitObjectWrapper { /** - * @see _.groupBy - **/ - groupBy( - callback: ListIterator, - thisArg?: any): _.LoDashImplicitObjectWrapper<_.Dictionary>; + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; /** - * @see _.groupBy - **/ - groupBy( - pluckValue: string): _.LoDashImplicitObjectWrapper<_.Dictionary>; + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; /** - * @see _.groupBy - **/ - groupBy( - whereValue: W): _.LoDashImplicitObjectWrapper<_.Dictionary>; + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: Object + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: Object + ): LoDashExplicitObjectWrapper>; } //_.include From 20636b122b76644e4d8d9b4337d395a40d9f9171 Mon Sep 17 00:00:00 2001 From: vvakame Date: Tue, 1 Dec 2015 10:45:06 +0900 Subject: [PATCH 097/107] switch to TypeScript 1.7.3 --- npm-shrinkwrap.json | 441 ++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 203 insertions(+), 240 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index da07b4d07c..6dc63bfb0b 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -2,254 +2,217 @@ "name": "DefinitelyTyped", "version": "0.0.1", "dependencies": { + "assertion-error": { + "version": "1.0.1", + "from": "assertion-error@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.1.tgz" + }, + "balanced-match": { + "version": "0.3.0", + "from": "balanced-match@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz" + }, + "bluebird": { + "version": "2.10.2", + "from": "bluebird@>=2.10.1 <3.0.0", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.10.2.tgz" + }, + "brace-expansion": { + "version": "1.1.2", + "from": "brace-expansion@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.2.tgz" + }, + "concat-map": { + "version": "0.0.1", + "from": "concat-map@0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + }, + "core-util-is": { + "version": "1.0.2", + "from": "core-util-is@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz" + }, + "definition-header": { + "version": "0.1.0", + "from": "definition-header@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/definition-header/-/definition-header-0.1.0.tgz" + }, "definition-tester": { "version": "0.3.0", "from": "definition-tester@0.3.0", + "resolved": "https://registry.npmjs.org/definition-tester/-/definition-tester-0.3.0.tgz" + }, + "findup-sync": { + "version": "0.3.0", + "from": "findup-sync@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz" + }, + "git-wrapper": { + "version": "0.1.1", + "from": "git-wrapper@>=0.1.1 <0.2.0", + "resolved": "https://registry.npmjs.org/git-wrapper/-/git-wrapper-0.1.1.tgz" + }, + "glob": { + "version": "5.0.15", + "from": "glob@>=5.0.14 <6.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz" + }, + "hoek": { + "version": "2.16.3", + "from": "hoek@>=2.2.0 <3.0.0", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz" + }, + "inflight": { + "version": "1.0.4", + "from": "inflight@>=1.0.4 <2.0.0", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz" + }, + "inherits": { + "version": "2.0.1", + "from": "inherits@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "isarray": { + "version": "0.0.1", + "from": "isarray@0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" + }, + "isemail": { + "version": "1.2.0", + "from": "isemail@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/isemail/-/isemail-1.2.0.tgz" + }, + "joi": { + "version": "4.9.0", + "from": "joi@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/joi/-/joi-4.9.0.tgz" + }, + "joi-assert": { + "version": "0.0.3", + "from": "joi-assert@0.0.3", + "resolved": "https://registry.npmjs.org/joi-assert/-/joi-assert-0.0.3.tgz" + }, + "jsonparse": { + "version": "0.0.5", + "from": "jsonparse@0.0.5", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-0.0.5.tgz" + }, + "JSONStream": { + "version": "0.8.4", + "from": "JSONStream@>=0.8.4 <0.9.0", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz" + }, + "lazy.js": { + "version": "0.4.2", + "from": "lazy.js@>=0.4.2 <0.5.0", + "resolved": "https://registry.npmjs.org/lazy.js/-/lazy.js-0.4.2.tgz" + }, + "manticore": { + "version": "0.2.4", + "from": "manticore@>=0.2.4 <0.3.0", + "resolved": "https://registry.npmjs.org/manticore/-/manticore-0.2.4.tgz", "dependencies": { "bluebird": { - "version": "2.10.1", - "from": "bluebird@>=2.10.1 <3.0.0", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.10.1.tgz" - }, - "definition-header": { - "version": "0.1.0", - "from": "definition-header@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/definition-header/-/definition-header-0.1.0.tgz", - "dependencies": { - "joi": { - "version": "4.9.0", - "from": "joi@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/joi/-/joi-4.9.0.tgz", - "dependencies": { - "hoek": { - "version": "2.16.3", - "from": "hoek@>=2.2.0 <3.0.0", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz" - }, - "topo": { - "version": "1.0.3", - "from": "topo@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/topo/-/topo-1.0.3.tgz" - }, - "isemail": { - "version": "1.2.0", - "from": "isemail@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/isemail/-/isemail-1.2.0.tgz" - }, - "moment": { - "version": "2.10.6", - "from": "moment@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.10.6.tgz" - } - } - }, - "joi-assert": { - "version": "0.0.3", - "from": "joi-assert@0.0.3", - "resolved": "https://registry.npmjs.org/joi-assert/-/joi-assert-0.0.3.tgz", - "dependencies": { - "assertion-error": { - "version": "1.0.1", - "from": "assertion-error@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.1.tgz" - } - } - }, - "parsimmon": { - "version": "0.5.1", - "from": "parsimmon@>=0.5.0 <0.6.0", - "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-0.5.1.tgz", - "dependencies": { - "pjs": { - "version": "5.1.1", - "from": "pjs@>=5.0.0 <6.0.0", - "resolved": "https://registry.npmjs.org/pjs/-/pjs-5.1.1.tgz" - } - } - }, - "xregexp": { - "version": "2.0.0", - "from": "xregexp@>=2.0.0 <2.1.0", - "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz" - } - } - }, - "findup-sync": { - "version": "0.3.0", - "from": "findup-sync@>=0.3.0 <0.4.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz" - }, - "git-wrapper": { - "version": "0.1.1", - "from": "git-wrapper@>=0.1.1 <0.2.0", - "resolved": "https://registry.npmjs.org/git-wrapper/-/git-wrapper-0.1.1.tgz" - }, - "glob": { - "version": "5.0.14", - "from": "glob@>=5.0.14 <6.0.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.14.tgz", - "dependencies": { - "inflight": { - "version": "1.0.4", - "from": "inflight@>=1.0.4 <2.0.0", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz", - "dependencies": { - "wrappy": { - "version": "1.0.1", - "from": "wrappy@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" - } - } - }, - "inherits": { - "version": "2.0.1", - "from": "inherits@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" - }, - "minimatch": { - "version": "2.0.10", - "from": "minimatch@>=2.0.1 <3.0.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", - "dependencies": { - "brace-expansion": { - "version": "1.1.0", - "from": "brace-expansion@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz", - "dependencies": { - "balanced-match": { - "version": "0.2.0", - "from": "balanced-match@>=0.2.0 <0.3.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz" - }, - "concat-map": { - "version": "0.0.1", - "from": "concat-map@0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" - } - } - } - } - }, - "once": { - "version": "1.3.2", - "from": "once@>=1.3.0 <2.0.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz", - "dependencies": { - "wrappy": { - "version": "1.0.1", - "from": "wrappy@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" - } - } - }, - "path-is-absolute": { - "version": "1.0.0", - "from": "path-is-absolute@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz" - } - } - }, - "lazy.js": { - "version": "0.4.2", - "from": "lazy.js@>=0.4.2 <0.5.0", - "resolved": "https://registry.npmjs.org/lazy.js/-/lazy.js-0.4.2.tgz" - }, - "manticore": { - "version": "0.2.4", - "from": "manticore@>=0.2.4 <0.3.0", - "resolved": "https://registry.npmjs.org/manticore/-/manticore-0.2.4.tgz", - "dependencies": { - "JSONStream": { - "version": "0.8.4", - "from": "JSONStream@>=0.8.4 <0.9.0", - "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz", - "dependencies": { - "jsonparse": { - "version": "0.0.5", - "from": "jsonparse@0.0.5", - "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-0.0.5.tgz" - }, - "through": { - "version": "2.3.8", - "from": "through@>=2.2.7 <3.0.0", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz" - } - } - }, - "bluebird": { - "version": "1.2.4", - "from": "bluebird@>=1.2.4 <2.0.0", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-1.2.4.tgz" - }, - "through2": { - "version": "0.5.1", - "from": "through2@>=0.5.1 <0.6.0", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz", - "dependencies": { - "readable-stream": { - "version": "1.0.33", - "from": "readable-stream@>=1.0.17 <1.1.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz", - "dependencies": { - "core-util-is": { - "version": "1.0.1", - "from": "core-util-is@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" - }, - "isarray": { - "version": "0.0.1", - "from": "isarray@0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" - }, - "string_decoder": { - "version": "0.10.31", - "from": "string_decoder@>=0.10.0 <0.11.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" - }, - "inherits": { - "version": "2.0.1", - "from": "inherits@>=2.0.1 <2.1.0", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" - } - } - }, - "xtend": { - "version": "3.0.0", - "from": "xtend@>=3.0.0 <3.1.0", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz" - } - } - }, - "type-detect": { - "version": "0.1.2", - "from": "type-detect@>=0.1.2 <0.2.0", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.2.tgz" - } - } - }, - "optimist": { - "version": "0.6.1", - "from": "optimist@>=0.6.1 <0.7.0", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "dependencies": { - "wordwrap": { - "version": "0.0.3", - "from": "wordwrap@>=0.0.2 <0.1.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz" - }, - "minimist": { - "version": "0.0.10", - "from": "minimist@>=0.0.1 <0.1.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz" - } - } + "version": "1.2.4", + "from": "bluebird@>=1.2.4 <2.0.0", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-1.2.4.tgz" } } }, + "minimatch": { + "version": "3.0.0", + "from": "minimatch@>=2.0.0 <3.0.0||>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz" + }, + "minimist": { + "version": "0.0.10", + "from": "minimist@>=0.0.1 <0.1.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz" + }, + "moment": { + "version": "2.10.6", + "from": "moment@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.10.6.tgz" + }, + "once": { + "version": "1.3.3", + "from": "once@>=1.3.0 <2.0.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz" + }, + "optimist": { + "version": "0.6.1", + "from": "optimist@>=0.6.1 <0.7.0", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz" + }, + "parsimmon": { + "version": "0.5.1", + "from": "parsimmon@>=0.5.0 <0.6.0", + "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-0.5.1.tgz" + }, + "path-is-absolute": { + "version": "1.0.0", + "from": "path-is-absolute@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz" + }, + "pjs": { + "version": "5.1.1", + "from": "pjs@>=5.0.0 <6.0.0", + "resolved": "https://registry.npmjs.org/pjs/-/pjs-5.1.1.tgz" + }, + "readable-stream": { + "version": "1.0.33", + "from": "readable-stream@>=1.0.17 <1.1.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz" + }, + "string_decoder": { + "version": "0.10.31", + "from": "string_decoder@>=0.10.0 <0.11.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" + }, + "through": { + "version": "2.3.8", + "from": "through@>=2.2.7 <3.0.0", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz" + }, + "through2": { + "version": "0.5.1", + "from": "through2@>=0.5.1 <0.6.0", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz" + }, + "topo": { + "version": "1.1.0", + "from": "topo@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/topo/-/topo-1.1.0.tgz" + }, + "type-detect": { + "version": "0.1.2", + "from": "type-detect@>=0.1.2 <0.2.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.2.tgz" + }, "typescript": { - "version": "1.6.2", - "from": "typescript@1.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.6.2.tgz" + "version": "1.7.3", + "from": "typescript@1.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.7.3.tgz" + }, + "wordwrap": { + "version": "0.0.3", + "from": "wordwrap@>=0.0.2 <0.1.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz" + }, + "wrappy": { + "version": "1.0.1", + "from": "wrappy@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" + }, + "xregexp": { + "version": "2.0.0", + "from": "xregexp@>=2.0.0 <2.1.0", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz" + }, + "xtend": { + "version": "3.0.0", + "from": "xtend@>=3.0.0 <3.1.0", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz" } } } diff --git a/package.json b/package.json index 2b9d019f80..78904930b8 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,6 @@ }, "devDependencies": { "definition-tester": "0.3.0", - "typescript": "1.6.2" + "typescript": "1.7.3" } } From bb3a32550916d94ce8aa75e9f1b078f9d7d921a1 Mon Sep 17 00:00:00 2001 From: vvakame Date: Tue, 1 Dec 2015 10:45:39 +0900 Subject: [PATCH 098/107] use Node.js v4 on Travis CI --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f996631624..48704282ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - "iojs-v2" + - 4 sudo: false From ee7ca3d75acb71f06af76684be3b7e729ab56f84 Mon Sep 17 00:00:00 2001 From: vvakame Date: Tue, 1 Dec 2015 11:20:58 +0900 Subject: [PATCH 099/107] add npm-debug.log to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2ea470b9ec..2a52c95e0c 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ *.map *.swp .DS_Store +npm-debug.log _Resharper.DefinitelyTyped bin From 6278aa9cf60d9a21dae9671e694e60a67e0f89bb Mon Sep 17 00:00:00 2001 From: vvakame Date: Tue, 1 Dec 2015 11:21:13 +0900 Subject: [PATCH 100/107] fix jasmine-matchers/jasmine-matchers-tests.ts --- jasmine-matchers/jasmine-matchers-tests.ts | 138 ++++++++++----------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/jasmine-matchers/jasmine-matchers-tests.ts b/jasmine-matchers/jasmine-matchers-tests.ts index d1cbc0f90f..f281b4a830 100644 --- a/jasmine-matchers/jasmine-matchers-tests.ts +++ b/jasmine-matchers/jasmine-matchers-tests.ts @@ -27,8 +27,8 @@ describe('toBeArray', function () { }); it('should pass for [1,"",{}]', function () { expect([ - 1, - "", + 1, + "", { } ]).toBeArray(); @@ -115,13 +115,13 @@ describe('toBeOneOf', function () { describe('matches', function () { it('should find "a" in ["a", "b"]', function () { expect('a').toBeOneOf([ - 'a', + 'a', 'b' ]); }); it('should find "uxebu" in ["company", "uxebu"]', function () { expect('uxebu').toBeOneOf([ - 'company', + 'company', 'uxebu' ]); }); @@ -129,30 +129,30 @@ describe('toBeOneOf', function () { describe('non-matches', function () { it('should not find "" in [" ", "0"]', function () { expect('').not.toBeOneOf([ - ' ', + ' ', '0' ]); }); it('should not find "a" in ["b", "c"]', function () { expect('a').not.toBeOneOf([ - 'b', + 'b', 'c' ]); }); }); }); describe('toBeCloseToOneOf', function () { - function oneDigitOff(actual, expected) { + function oneDigitOff(actual: any, expected: any) { var actualInt = parseInt(actual, 10); return actualInt - 1 <= expected && actualInt + 1 >= expected; } - function tenPercentOff(actual, expected) { + function tenPercentOff(actual: any, expected: any) { return expected * 0.9 <= actual && expected * 1.1 >= actual; } - function oneDigitOrTenPercentOff(actual, expected) { + function oneDigitOrTenPercentOff(actual: any, expected: any) { return oneDigitOff(actual, expected) || tenPercentOff(actual, expected); } - function twoDecimalsOff(actual, expected) { + function twoDecimalsOff(actual: any, expected: any) { var lower = ((expected * 100) - 2) / 100; var upper = ((expected * 100) + 2) / 100; return lower <= actual && upper >= actual; @@ -160,25 +160,25 @@ describe('toBeCloseToOneOf', function () { describe('matches', function () { it('should say 7 is close to one of [8, 9]', function () { expect(7).toBeCloseToOneOf([ - 8, + 8, 9 ], oneDigitOff); }); it('should say 2 is 10% off of one of [2.2, 1.0]', function () { expect(2).toBeCloseToOneOf([ - 2.2, + 2.2, 1.0 ], tenPercentOff); }); it('should say 7 is close to one of [8, 9]', function () { expect(7).toBeCloseToOneOf([ - 8, + 8, 9 ], oneDigitOrTenPercentOff); }); it('should say 1.345 two decimals off of [1.325, 1.365]', function () { expect(1.345).toBeCloseToOneOf([ - 1.325, + 1.325, 1.365 ], twoDecimalsOff); }); @@ -186,26 +186,26 @@ describe('toBeCloseToOneOf', function () { describe('non-matches', function () { it('should say 7 is NOT one off of [9, 10, 11]', function () { expect(7).not.toBeCloseToOneOf([ - 9, - 10, + 9, + 10, 11 ], oneDigitOff); }); it('should say 1 is close to one of [8, 9]', function () { expect(1).not.toBeCloseToOneOf([ - 8, + 8, 9 ], oneDigitOrTenPercentOff); }); it('should say 1.9 is NOT 10% off of one of [2.2, 1.0]', function () { expect(1.9).not.toBeCloseToOneOf([ - 2.2, + 2.2, 1.0 ], tenPercentOff); }); it('should say 1.345 two decimals off of [1.325, 1.365]', function () { expect(1.304).not.toBeCloseToOneOf([ - 1.325, + 1.325, 1.365 ], twoDecimalsOff); }); @@ -216,7 +216,7 @@ describe('toContainOnce', function () { describe('matches', function () { it('should work for arrays', function () { expect([ - 1, + 1, 2 ]).toContainOnce(1); }); @@ -227,7 +227,7 @@ describe('toContainOnce', function () { describe('non-matches', function () { it('should work for arrays', function () { expect([ - 1, + 1, 2 ]).not.toContainOnce(3); }); @@ -257,7 +257,7 @@ describe('toHaveLength', function () { describe('toHaveProperties', function () { describe('matches', function () { it('should work for `{x:0, y:undefined}`', function () { - var obj = { + var obj: any = { x: 0, y: undefined }; @@ -268,7 +268,7 @@ describe('toHaveProperties', function () { describe('toHavePropertiesWithValues', function () { describe('matches', function () { it('should work with a reference object', function () { - function C() { + var C: any = function C() { this.x = 0; } C.prototype.y = 'arbitrary'; @@ -283,7 +283,7 @@ describe('toHavePropertiesWithValues', function () { describe('toHaveOwnProperties', function () { describe('matches', function () { it('should work for `{x:0, y:undefined}`', function () { - var obj = { + var obj: any = { x: 0, y: undefined }; @@ -322,14 +322,14 @@ describe('toHaveBeenCalledXTimes', function () { describe('toExactlyHaveProperties', function () { describe('matches', function () { it('should work for `{x:0, y:undefined}`', function () { - var obj = { + var obj: any = { x: 0, y: undefined }; expect(obj).toExactlyHaveProperties('x', 'y'); }); it('should work in any order', function () { - var obj = { + var obj: any = { x: 0, y: undefined }; @@ -338,14 +338,14 @@ describe('toExactlyHaveProperties', function () { }); describe('non-matches', function () { it('should work for too many properties', function () { - var obj = { + var obj: any = { x: 0, y: undefined }; expect(obj).not.toExactlyHaveProperties('x'); }); it('should work for missing properties', function () { - var obj = { + var obj: any = { x: 0, y: undefined }; @@ -375,17 +375,17 @@ describe('toEndWith', function () { describe('matches', function () { it('should work for string', function () { expect([ - '1', + '1', '2' ]).toEndWith('2'); }); it('should work for array', function () { expect([ - 3, - 4, + 3, + 4, 5 ]).toEndWith([ - 4, + 4, 5 ]); }); @@ -393,17 +393,17 @@ describe('toEndWith', function () { describe('non-matches', function () { it('should work for string', function () { expect([ - '1', + '1', '2' ]).not.toEndWith('3'); }); it('should work for array', function () { expect([ - 3, - 4, + 3, + 4, 5 ]).not.toEndWith([ - 3, + 3, 4 ]); }); @@ -419,8 +419,8 @@ describe('toEachEndWith', function () { }); it('should work for array with multiple elements', function () { expect([ - 'one', - 'zwee', + 'one', + 'zwee', 'three' ]).toEachEndWith('e'); }); @@ -433,8 +433,8 @@ describe('toEachEndWith', function () { }); it('should work for array with multiple elements', function () { expect([ - 'one', - 'zwei', + 'one', + 'zwei', 'three' ]).not.toEachEndWith('e'); }); @@ -449,8 +449,8 @@ describe('toSomeEndWith', function () { }); it('should work for array with multiple elements', function () { expect([ - 'one', - 'zwee', + 'one', + 'zwee', 'three' ]).toSomeEndWith('ee'); }); @@ -463,8 +463,8 @@ describe('toSomeEndWith', function () { }); it('should work for array with multiple elements', function () { expect([ - 'one', - 'zwei', + 'one', + 'zwei', 'three' ]).not.toSomeEndWith('a'); }); @@ -491,17 +491,17 @@ describe('toStartWith', function () { describe('matches', function () { it('should work for string', function () { expect([ - '1', + '1', '2' ]).toStartWith('1'); }); it('should work for array', function () { expect([ - 3, - 4, + 3, + 4, 5 ]).toStartWith([ - 3, + 3, 4 ]); }); @@ -509,17 +509,17 @@ describe('toStartWith', function () { describe('non-matches', function () { it('should work for string', function () { expect([ - '1', + '1', '2' ]).not.toStartWith('3'); }); it('should work for array', function () { expect([ - 3, - 4, + 3, + 4, 5 ]).not.toStartWith([ - 4, + 4, 5 ]); }); @@ -535,8 +535,8 @@ describe('toEachStartWith', function () { }); it('should work for array with multiple elements', function () { expect([ - 'one', - 'onetwo', + 'one', + 'onetwo', 'onethree' ]).toEachStartWith('o'); }); @@ -549,8 +549,8 @@ describe('toEachStartWith', function () { }); it('should work for array with multiple elements', function () { expect([ - 'one', - 'two', + 'one', + 'two', 'onethree' ]).not.toEachStartWith('o'); }); @@ -565,8 +565,8 @@ describe('toSomeStartWith', function () { }); it('should work for array with multiple elements', function () { expect([ - 'one', - 'onetwo', + 'one', + 'onetwo', 'three' ]).toSomeStartWith('one'); }); @@ -579,8 +579,8 @@ describe('toSomeStartWith', function () { }); it('should work for array with multiple elements', function () { expect([ - 'one', - 'two', + 'one', + 'two', 'onethree' ]).not.toSomeStartWith('a'); }); @@ -610,19 +610,19 @@ describe('toStartWithEither', function () { describe('matches', function () { it('should work for string', function () { expect([ - '1', + '1', '2' ]).toStartWithEither('1', '2'); }); it('should work for array', function () { expect([ - 3, - 4, + 3, + 4, 5 ]).toStartWithEither([ 4 ], [ - 3, + 3, 4 ]); }); @@ -630,20 +630,20 @@ describe('toStartWithEither', function () { describe('non-matches', function () { it('should work for string', function () { expect([ - '1', + '1', '2' ]).not.toStartWithEither('3'); }); it('should work for array', function () { expect([ - 3, - 4, + 3, + 4, 5 ]).not.toStartWithEither([ - 5, + 5, 6 ], [ - 4, + 4, 5 ]); }); From 245931eb8a6cd9b498a5cf39ce29a65e9979b22d Mon Sep 17 00:00:00 2001 From: vvakame Date: Tue, 1 Dec 2015 11:24:18 +0900 Subject: [PATCH 101/107] fix intro.js --- intro.js/intro.js-tests.ts | 4 ++-- intro.js/intro.js.d.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/intro.js/intro.js-tests.ts b/intro.js/intro.js-tests.ts index b49eb5078e..b8e8126ae9 100644 --- a/intro.js/intro.js-tests.ts +++ b/intro.js/intro.js-tests.ts @@ -9,11 +9,11 @@ intro.setOptions({ intro: "Hello world!" }, { - element: document.querySelector('#step1'), + element: document.querySelector('#step1') as HTMLElement, intro : "This is a tooltip." }, { - element : document.querySelectorAll('#step2')[0], + element : document.querySelectorAll('#step2')[0] as HTMLElement, intro : "Ok, wasn't that fun?", position: 'right' }, diff --git a/intro.js/intro.js.d.ts b/intro.js/intro.js.d.ts index d54a5456ef..15a73f5178 100644 --- a/intro.js/intro.js.d.ts +++ b/intro.js/intro.js.d.ts @@ -14,7 +14,7 @@ declare module IntroJs { interface Step { intro: string; element?: string|HTMLElement; - position?: Positions; + position?: string|Positions; } interface Options { From 12bb4be8e25cb31f17a32ec99c1a5537353d1d15 Mon Sep 17 00:00:00 2001 From: Ritzlgrmft Date: Tue, 1 Dec 2015 10:51:24 +0100 Subject: [PATCH 102/107] Additional properties added --- cordova/plugins/Device.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cordova/plugins/Device.d.ts b/cordova/plugins/Device.d.ts index a25c1aadc8..1abb37596e 100644 --- a/cordova/plugins/Device.d.ts +++ b/cordova/plugins/Device.d.ts @@ -26,6 +26,9 @@ interface Device { version: string; /** Get the device's manufacturer. */ manufacturer: string; -} + /** Whether the device is running on a simulator. */ + isVirtual: boolean; + /** Get the device hardware serial number. */ + serial: string;} declare var device: Device; \ No newline at end of file From d9ed4d259febfdce05d5ea4bfb4db410b49c3a06 Mon Sep 17 00:00:00 2001 From: "paul.lessing" Date: Tue, 1 Dec 2015 10:59:43 +0000 Subject: [PATCH 103/107] Add email-validator 1.0.3 --- email-validator/email-validator-tests.ts | 13 +++++++++++++ email-validator/email-validator.d.ts | 8 ++++++++ 2 files changed, 21 insertions(+) create mode 100644 email-validator/email-validator-tests.ts create mode 100644 email-validator/email-validator.d.ts diff --git a/email-validator/email-validator-tests.ts b/email-validator/email-validator-tests.ts new file mode 100644 index 0000000000..61d4c6dfa6 --- /dev/null +++ b/email-validator/email-validator-tests.ts @@ -0,0 +1,13 @@ +/// + +import emailValidator = require('email-validator'); +import { validate } from 'email-validator'; + +var result: boolean; + +// Trivial code requires trivial tests +result = validate('some email'); +result = validate(null); + +result = emailValidator.validate('some email'); +result = emailValidator.validate(null); diff --git a/email-validator/email-validator.d.ts b/email-validator/email-validator.d.ts new file mode 100644 index 0000000000..299ebb19f6 --- /dev/null +++ b/email-validator/email-validator.d.ts @@ -0,0 +1,8 @@ +// Type definitions for email-validator 1.0.3 +// Project: https://github.com/Sembiance/email-validator +// Definitions by: Paul Lessing +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "email-validator" { + export function validate(email: String): boolean; +} From dd3fb2e7c8d31a01e239df5c504bd8c4c7e99fed Mon Sep 17 00:00:00 2001 From: William Candillon Date: Tue, 1 Dec 2015 12:29:34 +0100 Subject: [PATCH 104/107] Fix type for SourceNode.add() --- source-map/source-map.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source-map/source-map.d.ts b/source-map/source-map.d.ts index 3ddd49b537..016798d913 100644 --- a/source-map/source-map.d.ts +++ b/source-map/source-map.d.ts @@ -73,7 +73,7 @@ declare module SourceMap { constructor(line: number, column: number, source: string); constructor(line: number, column: number, source: string, chunk?: string, name?: string); public static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode; - public add(chunk: string): void; + public add(chunk: any): SourceNode; public prepend(chunk: string): void; public setSourceContent(sourceFile: string, sourceContent: string): void; public walk(fn: (chunk: string, mapping: MappedPosition) => void): void; From 1c572762b93d4b059d89339867edf54946176361 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Tue, 1 Dec 2015 12:47:58 +0100 Subject: [PATCH 105/107] :lipstick: --- source-map/source-map.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source-map/source-map.d.ts b/source-map/source-map.d.ts index 016798d913..34aae2b6a2 100644 --- a/source-map/source-map.d.ts +++ b/source-map/source-map.d.ts @@ -74,7 +74,7 @@ declare module SourceMap { constructor(line: number, column: number, source: string, chunk?: string, name?: string); public static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode; public add(chunk: any): SourceNode; - public prepend(chunk: string): void; + public prepend(chunk: any): SourceNode; public setSourceContent(sourceFile: string, sourceContent: string): void; public walk(fn: (chunk: string, mapping: MappedPosition) => void): void; public walkSourceContents(fn: (file: string, content: string) => void): void; From 73a82c7c312f4a8df75d62605ef984b54fda9094 Mon Sep 17 00:00:00 2001 From: Marcin Porebski Date: Tue, 1 Dec 2015 15:39:21 +0100 Subject: [PATCH 106/107] Wreck 7.0.0 - naming convention fix --- wreck/wreck.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wreck/wreck.d.ts b/wreck/wreck.d.ts index 135b2f4f2c..8bc7b2d249 100644 --- a/wreck/wreck.d.ts +++ b/wreck/wreck.d.ts @@ -11,9 +11,9 @@ declare module "wreck" import stream = require('stream'); - interface IWreckObject + interface WreckObject { - defaults: (options: any) => IWreckObject; + defaults: (options: any) => WreckObject; request: (method: string, uri: string, options: any, callback?: (err: any, response: http.IncomingMessage) => void) => http.ClientRequest; @@ -35,7 +35,7 @@ declare module "wreck" }; } - var wreck: IWreckObject; + var wreck: WreckObject; export = wreck; } From 3ffd32a260e370b7622a5b0981e576e578c1efba Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sun, 29 Nov 2015 06:56:10 +0500 Subject: [PATCH 107/107] lodash: signatures of _.throttle have been changed --- lodash/lodash-tests.ts | 57 +++++++++++++++++++++--------- lodash/lodash.d.ts | 79 +++++++++++++++++++++++++++--------------- 2 files changed, 93 insertions(+), 43 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 48f69210df..65b429e9f2 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4554,9 +4554,6 @@ source.addEventListener('message', <_.LoDashImplicitObjectWrapper>_(fu 'maxWait': 1000 }), false); -var returnedDebounce = _.throttle(function (a: any) { return a * 5; }, 5); -returnedThrottled(4); - // _.defer module TestDefer { type SampleFunc = (a: number, b: string) => boolean; @@ -4671,9 +4668,6 @@ result = _.memoize(testMemoizeFn, te result = (_(testMemoizeFn).memoize().value()); result = (_(testMemoizeFn).memoize(testMemoizeResolverFn).value()); -var returnedMemoize = _.throttle(function (a: any) { return a * 5; }, 5); -returnedMemoize(4); - // _.modArgs module TestModArgs { type Func1 = (a: boolean) => boolean; @@ -4768,9 +4762,6 @@ module TestOnce { } } -var returnedOnce = _.throttle(function (a: any) { return a * 5; }, 5); -returnedOnce(4); - var greetPartial = function (greeting: string, name: string) { return greeting + ' ' + name; }; var hi = _.partial(greetPartial, 'hi'); hi('moe'); @@ -4835,15 +4826,49 @@ interface TestSpreadResultFn { result = (_.spread(testSpreadFn))(['fred', 'hello']); result = (_(testSpreadFn).spread().value())(['fred', 'hello']); -var throttled = _.throttle(function () { }, 100); -jQuery(window).on('scroll', throttled); +// _.throttle +module TestThrottle { + interface SampleFunc { + (n: number, s: string): boolean; + } -jQuery('.interactive').on('click', _.throttle(function () { }, 300000, { - 'trailing': false -})); + interface Options { + leading?: boolean; + trailing?: boolean; + } -var returnedThrottled = _.throttle(function (a: any) { return a * 5; }, 5); -returnedThrottled(4); + interface ResultFunc { + (n: number, s: string): boolean; + cancel(): void; + } + + let func: SampleFunc; + let options: Options; + + { + let result: ResultFunc; + + result = _.throttle(func); + result = _.throttle(func, 42); + result = _.throttle(func, 42, options); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).throttle(); + result = _(func).throttle(42); + result = _(func).throttle(42, options); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().throttle(); + result = _(func).chain().throttle(42); + result = _(func).chain().throttle(42, options); + } +} var helloWrap = function (name: string) { return 'hello ' + name; }; var helloWrap2 = _.wrap(helloWrap, function (func) { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 49de3691e2..91d7d410c5 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8444,41 +8444,62 @@ declare module _ { //_.throttle - interface LoDashStatic { - /** - * Creates a function that, when executed, will only call the func function at most once per - * every wait milliseconds. Provide an options object to indicate that func should be invoked - * on the leading and/or trailing edge of the wait timeout. Subsequent calls to the throttled - * function will return the result of the last func call. - * - * Note: If leading and trailing options are true func will be called on the trailing edge of - * the timeout only if the the throttled function is invoked more than once during the wait timeout. - * @param func The function to throttle. - * @param wait The number of milliseconds to throttle executions to. - * @param options The options object. - * @param options.leading Specify execution on the leading edge of the timeout. - * @param options.trailing Specify execution on the trailing edge of the timeout. - * @return The new throttled function. - **/ - throttle( - func: T, - wait: number, - options?: ThrottleSettings): T; - } - interface ThrottleSettings { - /** - * If you'd like to disable the leading-edge call, pass this as false. - **/ + * If you'd like to disable the leading-edge call, pass this as false. + */ leading?: boolean; /** - * If you'd like to disable the execution on the trailing-edge, pass false. - **/ + * If you'd like to disable the execution on the trailing-edge, pass false. + */ trailing?: boolean; } + interface LoDashStatic { + /** + * Creates a throttled function that only invokes func at most once per every wait milliseconds. The throttled + * function comes with a cancel method to cancel delayed invocations. Provide an options object to indicate + * that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls to + * the throttled function return the result of the last func call. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if + * the the throttled function is invoked more than once during the wait timeout. + * + * @param func The function to throttle. + * @param wait The number of milliseconds to throttle invocations to. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new throttled function. + */ + throttle( + func: T, + wait?: number, + options?: ThrottleSettings + ): T & Cancelable; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.throttle + */ + throttle( + wait?: number, + options?: ThrottleSettings + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.throttle + */ + throttle( + wait?: number, + options?: ThrottleSettings + ): LoDashExplicitObjectWrapper; + } + //_.wrap interface LoDashStatic { /** @@ -13221,6 +13242,10 @@ declare module _ { interface StringRepresentable { toString(): string; } + + interface Cancelable { + cancel(): void; + } } declare module "lodash" {