From 76ea613b90f40db3afae3ff77c21298d13775257 Mon Sep 17 00:00:00 2001 From: Gabriel Garcia Date: Mon, 20 Jul 2015 18:49:06 -0400 Subject: [PATCH 001/407] localforage typings --- localForage/localForage.d.ts | 135 ++++++++++++++++++----------------- 1 file changed, 70 insertions(+), 65 deletions(-) diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index b5c40dd61..6deef5277 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -3,71 +3,76 @@ // Definitions by: yuichi david pichsenmeister // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module lf { - interface ILocalForage { - /** - * Removes every key from the database, returning it to a blank slate. - */ - clear(callback: IErrorCallback): void - /** - * Iterate over all value/key pairs in datastore. - */ - iterate(iterateCallback: IIterateCallback): void - /** - * Get the name of a key based on its ID. - */ - key(keyIndex: number, callback: IKeyCallback): void - /** - * Get the list of all keys in the datastore. - */ - keys(callback: IKeysCallback): void; - /** - * Gets the number of keys in the offline store (i.e. its “length”). - */ - length(callback: INumberCallback): void - /** - * Gets an item from the storage library and supplies the result to a callback. - * If the key does not exist, getItem() will return null. - */ - getItem(key: string, callback: ICallback): void - getItem(key: string): IPromise - /** - * Saves data to an offline store. - */ - setItem(key: string, value: T, callback: ICallback): void - setItem(key: string, value: T): IPromise - /** - * Removes the value of a key from the offline store. - */ - removeItem(key: string, callback: IErrorCallback): void - removeItem(key: string): IPromise - } +/// - interface ICallback { - (err: any, value: T): void - } +interface LocalForageOptions { + driver?: LocalForageDriver | LocalForageDriver[]; + + name?: string; + + size?: number; + + storeName?: string; + + version?: string; + + description?: string; +} - interface IIterateCallback { - (value: T, key: string, iterationNumber: number): void - } +interface LocalForageDriver { + _driver: string; + + _initStorage(options: LocalForageOptions): void; + + _support: boolean | Promise; + + clear(callback: (err: any) => void): void; + + getItem(key: string, callback: (err: any, value: any) => void): void; + + key(keyIndex: number, callback: (err: any, key: string) => void): void; + + keys(callback: (err: any, keys: string[]) => void): void; + + length(callback: (err: any, numberOfKeys: number) => void): void; + + removeItem(key: string, callback: (err: any) => void): void; + + setItem(key: string, value: any, callback: (err: any, value: any) => void): void; +} - interface IErrorCallback { - (err: any): void - } - - interface IKeyCallback { - (err: any, keyName: string): void - } - - interface IKeysCallback { - (err: any, keys: Array): void - } - - interface INumberCallback { - (err: any, numberOfKeys: number): void - } - - interface IPromise { - then(callback: ICallback): void - } -} \ No newline at end of file +interface LocalForage { + LOCALSTORAGE: LocalForageDriver; + WEBSQL: LocalForageDriver; + INDEXEDDB: LocalForageDriver; + + config(options: LocalForageOptions): void; + + setDriver(driver: LocalForageDriver): void; + setDriver(driver: LocalForageDriver[]): void; + + getItem(key: string): Promise; + getItem(key: string, callback: (err: any, value: T) => void): void; + + setItem(key: string, value: T): Promise; + setItem(key: string, value: T, callback: (err: any, value: T) => void): void; + + removeItem(key: string): Promise; + removeItem(key: string, callback: (err: any) => void): void; + + clear(): Promise; + clear(callback: (err: any) => void): void; + + length(): Promise; + length(callback: (err: any, numberOfKeys: number) => void): void; + + key(keyIndex: number): Promise; + key(keyIndex: number, callback: (err: any, key: string) => void): void; + + keys(): Promise; + keys(callback: (err: any, keys: string[]) => void): void; + + iterate(iteratee: (value: any, key: string, iterationNumber: number) => any): Promise; + iterate(iteratee: (value: any, key: string, iterationNumber: number) => any, + callback: (err: any, result: any) => void): void; +} From e7335515d8bd5a258087918530842595554b909c Mon Sep 17 00:00:00 2001 From: Gabriel Garcia Date: Fri, 24 Jul 2015 18:01:38 -0400 Subject: [PATCH 002/407] Update localForage tests --- localForage/localForage-tests.ts | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/localForage/localForage-tests.ts b/localForage/localForage-tests.ts index 15638c1cb..59e429a76 100644 --- a/localForage/localForage-tests.ts +++ b/localForage/localForage-tests.ts @@ -1,13 +1,6 @@ /// -declare var localForage: lf.ILocalForage; -declare var callback: lf.ICallback; -declare var iterateCallback: lf.IIterateCallback; -declare var errorCallback: lf.IErrorCallback; -declare var keyCallback: lf.IKeyCallback; -declare var keysCallback: lf.IKeysCallback; -declare var numberCallback: lf.INumberCallback; -declare var promise: lf.IPromise; +declare var localForage: LocalForage; () => { localForage.clear((err: any) => { @@ -25,7 +18,7 @@ declare var promise: lf.IPromise; var newNumber: number = num; }); - localForage.key(0,(err: any, value: string) => { + localForage.key(0, (err: any, value: string) => { var newError: any = err; var newValue: string = value; }); @@ -40,9 +33,8 @@ declare var promise: lf.IPromise; var newStr: string = str }); - localForage.getItem("key").then((err: any, str: string) => { - var newError: any = err; - var newStr: string = str + localForage.getItem("key").then((str: string) => { + var newStr: string = str; }); localForage.setItem("key", "value",(err: any, str: string) => { @@ -50,8 +42,7 @@ declare var promise: lf.IPromise; var newStr: string = str }); - localForage.setItem("key", "value").then((err: any, str: string) => { - var newError: any = err; + localForage.setItem("key", "value").then((str: string) => { var newStr: string = str; }); @@ -59,10 +50,6 @@ declare var promise: lf.IPromise; var newError: any = err; }); - localForage.removeItem("key").then((err: any, str: string) => { - var newError: any = err; - var newStr: string = str + localForage.removeItem("key").then(() => { }); - - promise.then(callback); } From 90d7feb531e0935de1eebbac1bb5bedf8ab5ccc1 Mon Sep 17 00:00:00 2001 From: Gabriel Garcia Date: Fri, 24 Jul 2015 18:18:58 -0400 Subject: [PATCH 003/407] Correct misunderstanding of documentation --- angular-localForage/angular-localForage.d.ts | 4 ++-- localForage/localForage.d.ts | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/angular-localForage/angular-localForage.d.ts b/angular-localForage/angular-localForage.d.ts index ee2aeeb6d..c7a8f7dae 100644 --- a/angular-localForage/angular-localForage.d.ts +++ b/angular-localForage/angular-localForage.d.ts @@ -22,8 +22,8 @@ declare module angular.localForage { } interface ILocalForageService { - setDriver(driver:string):angular.IPromise; - driver():lf.ILocalForage; + driver(): LocalForageDriver; + setDriver(name: string | string[]): angular.IPromise; setItem(key:string, value:any):angular.IPromise; setItem(keys:Array, values:Array):angular.IPromise; diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index 6deef5277..d169d01e3 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -42,14 +42,17 @@ interface LocalForageDriver { } interface LocalForage { - LOCALSTORAGE: LocalForageDriver; - WEBSQL: LocalForageDriver; - INDEXEDDB: LocalForageDriver; + LOCALSTORAGE: string; + WEBSQL: string; + INDEXEDDB: string; config(options: LocalForageOptions): void; - setDriver(driver: LocalForageDriver): void; - setDriver(driver: LocalForageDriver[]): void; + driver(): LocalForageDriver; + setDriver(driver: string | string[]): Promise; + setDriver(driver: string | string[], callback: () => void, errorCallback: (error: any) => void): void; + defineDriver(driver: LocalForageDriver): Promise; + defineDriver(driver: LocalForageDriver, callback: () => void, errorCallback: (error: any) => void): void; getItem(key: string): Promise; getItem(key: string, callback: (err: any, value: T) => void): void; From a9b7384eb475599db9afe5b31b97a0d160922d01 Mon Sep 17 00:00:00 2001 From: benliddicott Date: Sat, 15 Aug 2015 11:26:16 +0100 Subject: [PATCH 004/407] static-eval.d.ts --- static-eval/static-eval.d.ts | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 static-eval/static-eval.d.ts diff --git a/static-eval/static-eval.d.ts b/static-eval/static-eval.d.ts new file mode 100644 index 000000000..61db0b405 --- /dev/null +++ b/static-eval/static-eval.d.ts @@ -0,0 +1,4 @@ +declare module 'static-eval' { + function evaluate(ast, vars: { [name: string]: any }); + export =evaluate; +} From b316f99df4612d7f11b1fb8f4e3ab4024f8a604a Mon Sep 17 00:00:00 2001 From: Stepan Mikhaylyuk Date: Wed, 19 Aug 2015 19:42:30 +0300 Subject: [PATCH 005/407] updated to 1.0.5 version added jsdocs. es6 import added module lscache for es6 import --- lscache/lscache.d.ts | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/lscache/lscache.d.ts b/lscache/lscache.d.ts index 24c34bd8d..340d54b76 100644 --- a/lscache/lscache.d.ts +++ b/lscache/lscache.d.ts @@ -1,13 +1,48 @@ -// Type definitions for lscache v1.0.2 +// Type definitions for lscache v1.0.5 // Project: https://github.com/pamelafox/lscache // Definitions by: Chris Martinez // Definitions: https://github.com/borisyankov/DefinitelyTyped interface LSCache { + /** + * Stores the value in localStorage. Expires after specified number of minutes. + * @param {string} key + * @param {Object|string} value + * @param {number} time + */ set(key: string, value: any, time?: number): void; + /** + * Retrieves specified value from localStorage, if not expired. + * @param {string} key + * @return {string|Object} + */ get(key: string): any; + /** + * Removes a value from localStorage. + * Equivalent to 'delete' in memcache, but that's a keyword in JS. + * @param {string} key + */ remove(key: string): void; + /** + * Flushes all lscache items and expiry markers without affecting rest of localStorage + */ + flush(): void; + /** + * Flushes expired lscache items and expiry markers without affecting rest of localStorage + */ + flushExpired(): void; + /** + * Appends CACHE_PREFIX so lscache will partition data in to different buckets. + * @param {string} bucket + */ + setBucket(bucket: string); + /** + * Resets the string being appended to CACHE_PREFIX so lscache will use the default storage behavior. + */ + resetBucket(): void; +} +declare module 'lscache' { + var lscache: LSCache; + export = lscache; } - -declare var lscache: LSCache; \ No newline at end of file From 35afc7dc2c61c0ea91b07bf7859488b61d83714b Mon Sep 17 00:00:00 2001 From: Stepan Mikhaylyuk Date: Wed, 19 Aug 2015 19:46:47 +0300 Subject: [PATCH 006/407] minor fix --- lscache/lscache.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lscache/lscache.d.ts b/lscache/lscache.d.ts index 340d54b76..ed5d133a5 100644 --- a/lscache/lscache.d.ts +++ b/lscache/lscache.d.ts @@ -36,12 +36,13 @@ interface LSCache { * Appends CACHE_PREFIX so lscache will partition data in to different buckets. * @param {string} bucket */ - setBucket(bucket: string); + setBucket(bucket: string):void; /** * Resets the string being appended to CACHE_PREFIX so lscache will use the default storage behavior. */ resetBucket(): void; } +declare var lscache:LSCache; declare module 'lscache' { var lscache: LSCache; export = lscache; From 39c95a0a56c3ccb7f29a91797099c48e61ba5388 Mon Sep 17 00:00:00 2001 From: MugeSo Date: Thu, 20 Aug 2015 10:43:39 +0900 Subject: [PATCH 007/407] redis: uniform indent to 4 spaces --- redis/redis.d.ts | 664 ++++++++++++++++++++++++----------------------- 1 file changed, 333 insertions(+), 331 deletions(-) diff --git a/redis/redis.d.ts b/redis/redis.d.ts index 8e9c97856..ec7220cee 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -1,6 +1,6 @@ // Type definitions for redis // Project: https://github.com/mranney/node_redis -// Definitions by: Carlos Ballesteros Velasco , Peter Harris +// Definitions by: Carlos Ballesteros Velasco , Peter Harris , TANAKA Koichi // Definitions: https://github.com/borisyankov/DefinitelyTyped // Imported from: https://github.com/soywiz/typescript-node-definitions/redis.d.ts @@ -8,347 +8,349 @@ /// declare module "redis" { - export function createClient(port_arg: number, host_arg?: string, options?: ClientOpts): RedisClient; - export function createClient(unix_socket: string, options?: ClientOpts): RedisClient; - export function createClient(options?: ClientOpts): RedisClient; - export function print(err: Error, reply: any): void; - export var debug_mode: boolean; + export function createClient(port_arg:number, host_arg?:string, options?:ClientOpts):RedisClient; + export function createClient(unix_socket:string, options?:ClientOpts):RedisClient; + export function createClient(options?:ClientOpts):RedisClient; - interface MessageHandler { - (channel: string, message: any): void; - } + export function print(err:Error, reply:any):void; - interface CommandT { //This is a placeholder to be used eventually, to not have to define each command twice, or four times if all caps versions are to be implemented. - (args: any[], callback?: ResCallbackT): void; - (...args: any[]): void; - } + export var debug_mode:boolean; - interface ResCallbackT { - (err: Error, res: R): void; - } + interface MessageHandler { + (channel:string, message:any): void; + } - interface ServerInfo { - redis_version: string; - versions: number[]; - } + interface CommandT { //This is a placeholder to be used eventually, to not have to define each command twice, or four times if all caps versions are to be implemented. + (args:any[], callback?:ResCallbackT): void; + (...args:any[]): void; + } - interface ClientOpts { - parser?: string; - return_buffers?: boolean; - detect_buffers?: boolean; - socket_nodelay?: boolean; - no_ready_check?: boolean; - enable_offline_queue?: boolean; - retry_max_delay?: number; - connect_timeout?: number; - max_attempts?: number; - auth_pass?: string; - } + interface ResCallbackT { + (err:Error, res:R): void; + } - interface RedisClient extends NodeJS.EventEmitter { - // event: connect - // event: error - // event: message - // event: pmessage - // event: subscribe - // event: psubscribe - // event: unsubscribe - // event: punsubscribe + interface ServerInfo { + redis_version: string; + versions: number[]; + } - connected: boolean; - retry_delay: number; - retry_backoff: number; - command_queue: any[]; - offline_queue: any[]; - server_info: ServerInfo; + interface ClientOpts { + parser?: string; + return_buffers?: boolean; + detect_buffers?: boolean; + socket_nodelay?: boolean; + no_ready_check?: boolean; + enable_offline_queue?: boolean; + retry_max_delay?: number; + connect_timeout?: number; + max_attempts?: number; + auth_pass?: string; + } - end(): void; + interface RedisClient extends NodeJS.EventEmitter { + // event: connect + // event: error + // event: message + // event: pmessage + // event: subscribe + // event: psubscribe + // event: unsubscribe + // event: punsubscribe - // Connection (http://redis.io/commands#connection) - auth(password: string, callback?: ResCallbackT): void; - ping(callback?: ResCallbackT): void; + connected: boolean; + retry_delay: number; + retry_backoff: number; + command_queue: any[]; + offline_queue: any[]; + server_info: ServerInfo; - // Strings (http://redis.io/commands#strings) - append(key: string, value: string, callback?: ResCallbackT): void; - bitcount(key: string, callback?: ResCallbackT): void; - bitcount(key: string, start: number, end: number, callback?: ResCallbackT): void; - set(key: string, value: string, callback?: ResCallbackT): void; - get(key: string, callback?: ResCallbackT): void; - exists(key: string, value: string, callback?: ResCallbackT): void; + end(): void; - publish(channel: string, value: any): void; - subscribe(channel: string): void; + // Connection (http://redis.io/commands#connection) + auth(password:string, callback?:ResCallbackT): void; + ping(callback?:ResCallbackT): void; - /* - commands = set_union([ - "get", "set", "setnx", "setex", "append", "strlen", "del", "exists", "setbit", "getbit", "setrange", "getrange", "substr", - "incr", "decr", "mget", "rpush", "lpush", "rpushx", "lpushx", "linsert", "rpop", "lpop", "brpop", "brpoplpush", "blpop", "llen", "lindex", - "lset", "lrange", "ltrim", "lrem", "rpoplpush", "sadd", "srem", "smove", "sismember", "scard", "spop", "srandmember", "sinter", "sinterstore", - "sunion", "sunionstore", "sdiff", "sdiffstore", "smembers", "zadd", "zincrby", "zrem", "zremrangebyscore", "zremrangebyrank", "zunionstore", - "zinterstore", "zrange", "zrangebyscore", "zrevrangebyscore", "zcount", "zrevrange", "zcard", "zscore", "zrank", "zrevrank", "hset", "hsetnx", - "hget", "hmset", "hmget", "hincrby", "hdel", "hlen", "hkeys", "hvals", "hgetall", "hexists", "incrby", "decrby", "getset", "mset", "msetnx", - "randomkey", "select", "move", "rename", "renamenx", "expire", "expireat", "keys", "dbsize", "auth", "ping", "echo", "save", "bgsave", - "bgrewriteaof", "shutdown", "lastsave", "type", "multi", "exec", "discard", "sync", "flushdb", "flushall", "sort", "info", "monitor", "ttl", - "persist", "slaveof", "debug", "config", "subscribe", "unsubscribe", "psubscribe", "punsubscribe", "publish", "watch", "unwatch", "cluster", - "restore", "migrate", "dump", "object", "client", "eval", "evalsha"], require("./lib/commands")); - */ + // Strings (http://redis.io/commands#strings) + append(key:string, value:string, callback?:ResCallbackT): void; + bitcount(key:string, callback?:ResCallbackT): void; + bitcount(key:string, start:number, end:number, callback?:ResCallbackT): void; + set(key:string, value:string, callback?:ResCallbackT): void; + get(key:string, callback?:ResCallbackT): void; + exists(key:string, value:string, callback?:ResCallbackT): void; - get(args: any[], callback?: ResCallbackT): void; - get(...args: any[]): void; - set(args: any[], callback?: ResCallbackT): void; - set(...args: any[]): void; - setnx(args: any[], callback?: ResCallbackT): void; - setnx(...args: any[]): void; - setex(args: any[], callback?: ResCallbackT): void; - setex(...args: any[]): void; - append(args: any[], callback?: ResCallbackT): void; - append(...args: any[]): void; - strlen(args: any[], callback?: ResCallbackT): void; - strlen(...args: any[]): void; - del(args: any[], callback?: ResCallbackT): void; - del(...args: any[]): void; - exists(args: any[], callback?: ResCallbackT): void; - exists(...args: any[]): void; - setbit(args: any[], callback?: ResCallbackT): void; - setbit(...args: any[]): void; - getbit(args: any[], callback?: ResCallbackT): void; - getbit(...args: any[]): void; - setrange(args: any[], callback?: ResCallbackT): void; - setrange(...args: any[]): void; - getrange(args: any[], callback?: ResCallbackT): void; - getrange(...args: any[]): void; - substr(args: any[], callback?: ResCallbackT): void; - substr(...args: any[]): void; - incr(args: any[], callback?: ResCallbackT): void; - incr(...args: any[]): void; - decr(args: any[], callback?: ResCallbackT): void; - decr(...args: any[]): void; - mget(args: any[], callback?: ResCallbackT): void; - mget(...args: any[]): void; - rpush(...args: any[]): void; - lpush(args: any[], callback?: ResCallbackT): void; - lpush(...args: any[]): void; - rpushx(args: any[], callback?: ResCallbackT): void; - rpushx(...args: any[]): void; - lpushx(args: any[], callback?: ResCallbackT): void; - lpushx(...args: any[]): void; - linsert(args: any[], callback?: ResCallbackT): void; - linsert(...args: any[]): void; - rpop(args: any[], callback?: ResCallbackT): void; - rpop(...args: any[]): void; - lpop(args: any[], callback?: ResCallbackT): void; - lpop(...args: any[]): void; - brpop(args: any[], callback?: ResCallbackT): void; - brpop(...args: any[]): void; - brpoplpush(args: any[], callback?: ResCallbackT): void; - brpoplpush(...args: any[]): void; - blpop(args: any[], callback?: ResCallbackT): void; - blpop(...args: any[]): void; - llen(args: any[], callback?: ResCallbackT): void; - llen(...args: any[]): void; - lindex(args: any[], callback?: ResCallbackT): void; - lindex(...args: any[]): void; - lset(args: any[], callback?: ResCallbackT): void; - lset(...args: any[]): void; - lrange(args: any[], callback?: ResCallbackT): void; - lrange(...args: any[]): void; - ltrim(args: any[], callback?: ResCallbackT): void; - ltrim(...args: any[]): void; - lrem(args: any[], callback?: ResCallbackT): void; - lrem(...args: any[]): void; - rpoplpush(args: any[], callback?: ResCallbackT): void; - rpoplpush(...args: any[]): void; - sadd(args: any[], callback?: ResCallbackT): void; - sadd(...args: any[]): void; - srem(args: any[], callback?: ResCallbackT): void; - srem(...args: any[]): void; - smove(args: any[], callback?: ResCallbackT): void; - smove(...args: any[]): void; - sismember(args: any[], callback?: ResCallbackT): void; - sismember(...args: any[]): void; - scard(args: any[], callback?: ResCallbackT): void; - scard(...args: any[]): void; - spop(args: any[], callback?: ResCallbackT): void; - spop(...args: any[]): void; - srandmember(args: any[], callback?: ResCallbackT): void; - srandmember(...args: any[]): void; - sinter(args: any[], callback?: ResCallbackT): void; - sinter(...args: any[]): void; - sinterstore(args: any[], callback?: ResCallbackT): void; - sinterstore(...args: any[]): void; - sunion(args: any[], callback?: ResCallbackT): void; - sunion(...args: any[]): void; - sunionstore(args: any[], callback?: ResCallbackT): void; - sunionstore(...args: any[]): void; - sdiff(args: any[], callback?: ResCallbackT): void; - sdiff(...args: any[]): void; - sdiffstore(args: any[], callback?: ResCallbackT): void; - sdiffstore(...args: any[]): void; - smembers(args: any[], callback?: ResCallbackT): void; - smembers(...args: any[]): void; - zadd(args: any[], callback?: ResCallbackT): void; - zadd(...args: any[]): void; - zincrby(args: any[], callback?: ResCallbackT): void; - zincrby(...args: any[]): void; - zrem(args: any[], callback?: ResCallbackT): void; - zrem(...args: any[]): void; - zremrangebyscore(args: any[], callback?: ResCallbackT): void; - zremrangebyscore(...args: any[]): void; - zremrangebyrank(args: any[], callback?: ResCallbackT): void; - zremrangebyrank(...args: any[]): void; - zunionstore(args: any[], callback?: ResCallbackT): void; - zunionstore(...args: any[]): void; - zinterstore(args: any[], callback?: ResCallbackT): void; - zinterstore(...args: any[]): void; - zrange(args: any[], callback?: ResCallbackT): void; - zrange(...args: any[]): void; - zrangebyscore(args: any[], callback?: ResCallbackT): void; - zrangebyscore(...args: any[]): void; - zrevrangebyscore(args: any[], callback?: ResCallbackT): void; - zrevrangebyscore(...args: any[]): void; - zcount(args: any[], callback?: ResCallbackT): void; - zcount(...args: any[]): void; - zrevrange(args: any[], callback?: ResCallbackT): void; - zrevrange(...args: any[]): void; - zcard(args: any[], callback?: ResCallbackT): void; - zcard(...args: any[]): void; - zscore(args: any[], callback?: ResCallbackT): void; - zscore(...args: any[]): void; - zrank(args: any[], callback?: ResCallbackT): void; - zrank(...args: any[]): void; - zrevrank(args: any[], callback?: ResCallbackT): void; - zrevrank(...args: any[]): void; - hset(args: any[], callback?: ResCallbackT): void; - hset(...args: any[]): void; - hsetnx(args: any[], callback?: ResCallbackT): void; - hsetnx(...args: any[]): void; - hget(args: any[], callback?: ResCallbackT): void; - hget(...args: any[]): void; - hmset(args: any[], callback?: ResCallbackT): void; - hmset(key: string, hash: any, callback?: ResCallbackT): void; - hmset(...args: any[]): void; - hmget(args: any[], callback?: ResCallbackT): void; - hmget(...args: any[]): void; - hincrby(args: any[], callback?: ResCallbackT): void; - hincrby(...args: any[]): void; - hdel(args: any[], callback?: ResCallbackT): void; - hdel(...args: any[]): void; - hlen(args: any[], callback?: ResCallbackT): void; - hlen(...args: any[]): void; - hkeys(args: any[], callback?: ResCallbackT): void; - hkeys(...args: any[]): void; - hvals(args: any[], callback?: ResCallbackT): void; - hvals(...args: any[]): void; - hgetall(args: any[], callback?: ResCallbackT): void; - hgetall(...args: any[]): void; - hgetall(key: string, callback?: ResCallbackT): void; - hexists(args: any[], callback?: ResCallbackT): void; - hexists(...args: any[]): void; - incrby(args: any[], callback?: ResCallbackT): void; - incrby(...args: any[]): void; - decrby(args: any[], callback?: ResCallbackT): void; - decrby(...args: any[]): void; - getset(args: any[], callback?: ResCallbackT): void; - getset(...args: any[]): void; - mset(args: any[], callback?: ResCallbackT): void; - mset(...args: any[]): void; - msetnx(args: any[], callback?: ResCallbackT): void; - msetnx(...args: any[]): void; - randomkey(args: any[], callback?: ResCallbackT): void; - randomkey(...args: any[]): void; - select(args: any[], callback?: ResCallbackT): void; - select(...args: any[]): void; - move(args: any[], callback?: ResCallbackT): void; - move(...args: any[]): void; - rename(args: any[], callback?: ResCallbackT): void; - rename(...args: any[]): void; - renamenx(args: any[], callback?: ResCallbackT): void; - renamenx(...args: any[]): void; - expire(args: any[], callback?: ResCallbackT): void; - expire(...args: any[]): void; - expireat(args: any[], callback?: ResCallbackT): void; - expireat(...args: any[]): void; - keys(args: any[], callback?: ResCallbackT): void; - keys(...args: any[]): void; - dbsize(args: any[], callback?: ResCallbackT): void; - dbsize(...args: any[]): void; - auth(args: any[], callback?: ResCallbackT): void; - auth(...args: any[]): void; - ping(args: any[], callback?: ResCallbackT): void; - ping(...args: any[]): void; - echo(args: any[], callback?: ResCallbackT): void; - echo(...args: any[]): void; - save(args: any[], callback?: ResCallbackT): void; - save(...args: any[]): void; - bgsave(args: any[], callback?: ResCallbackT): void; - bgsave(...args: any[]): void; - bgrewriteaof(args: any[], callback?: ResCallbackT): void; - bgrewriteaof(...args: any[]): void; - shutdown(args: any[], callback?: ResCallbackT): void; - shutdown(...args: any[]): void; - lastsave(args: any[], callback?: ResCallbackT): void; - lastsave(...args: any[]): void; - type(args: any[], callback?: ResCallbackT): void; - type(...args: any[]): void; - multi(args: any[], callback?: ResCallbackT): void; - multi(...args: any[]): void; - exec(args: any[], callback?: ResCallbackT): void; - exec(...args: any[]): void; - discard(args: any[], callback?: ResCallbackT): void; - discard(...args: any[]): void; - sync(args: any[], callback?: ResCallbackT): void; - sync(...args: any[]): void; - flushdb(args: any[], callback?: ResCallbackT): void; - flushdb(...args: any[]): void; - flushall(args: any[], callback?: ResCallbackT): void; - flushall(...args: any[]): void; - sort(args: any[], callback?: ResCallbackT): void; - sort(...args: any[]): void; - info(args: any[], callback?: ResCallbackT): void; - info(...args: any[]): void; - monitor(args: any[], callback?: ResCallbackT): void; - monitor(...args: any[]): void; - ttl(args: any[], callback?: ResCallbackT): void; - ttl(...args: any[]): void; - persist(args: any[], callback?: ResCallbackT): void; - persist(...args: any[]): void; - slaveof(args: any[], callback?: ResCallbackT): void; - slaveof(...args: any[]): void; - debug(args: any[], callback?: ResCallbackT): void; - debug(...args: any[]): void; - config(args: any[], callback?: ResCallbackT): void; - config(...args: any[]): void; - subscribe(args: any[], callback?: ResCallbackT): void; - subscribe(...args: any[]): void; - unsubscribe(args: any[], callback?: ResCallbackT): void; - unsubscribe(...args: any[]): void; - psubscribe(args: any[], callback?: ResCallbackT): void; - psubscribe(...args: any[]): void; - punsubscribe(args: any[], callback?: ResCallbackT): void; - punsubscribe(...args: any[]): void; - publish(args: any[], callback?: ResCallbackT): void; - publish(...args: any[]): void; - watch(args: any[], callback?: ResCallbackT): void; - watch(...args: any[]): void; - unwatch(args: any[], callback?: ResCallbackT): void; - unwatch(...args: any[]): void; - cluster(args: any[], callback?: ResCallbackT): void; - cluster(...args: any[]): void; - restore(args: any[], callback?: ResCallbackT): void; - restore(...args: any[]): void; - migrate(args: any[], callback?: ResCallbackT): void; - migrate(...args: any[]): void; - dump(args: any[], callback?: ResCallbackT): void; - dump(...args: any[]): void; - object(args: any[], callback?: ResCallbackT): void; - object(...args: any[]): void; - client(args: any[], callback?: ResCallbackT): void; - client(...args: any[]): void; - eval(args: any[], callback?: ResCallbackT): void; - eval(...args: any[]): void; - evalsha(args: any[], callback?: ResCallbackT): void; - evalsha(...args: any[]): void; - quit(args: any[], callback?: ResCallbackT): void; - quit(...args: any[]): void; - } + publish(channel:string, value:any): void; + subscribe(channel:string): void; + + /* + commands = set_union([ + "get", "set", "setnx", "setex", "append", "strlen", "del", "exists", "setbit", "getbit", "setrange", "getrange", "substr", + "incr", "decr", "mget", "rpush", "lpush", "rpushx", "lpushx", "linsert", "rpop", "lpop", "brpop", "brpoplpush", "blpop", "llen", "lindex", + "lset", "lrange", "ltrim", "lrem", "rpoplpush", "sadd", "srem", "smove", "sismember", "scard", "spop", "srandmember", "sinter", "sinterstore", + "sunion", "sunionstore", "sdiff", "sdiffstore", "smembers", "zadd", "zincrby", "zrem", "zremrangebyscore", "zremrangebyrank", "zunionstore", + "zinterstore", "zrange", "zrangebyscore", "zrevrangebyscore", "zcount", "zrevrange", "zcard", "zscore", "zrank", "zrevrank", "hset", "hsetnx", + "hget", "hmset", "hmget", "hincrby", "hdel", "hlen", "hkeys", "hvals", "hgetall", "hexists", "incrby", "decrby", "getset", "mset", "msetnx", + "randomkey", "select", "move", "rename", "renamenx", "expire", "expireat", "keys", "dbsize", "auth", "ping", "echo", "save", "bgsave", + "bgrewriteaof", "shutdown", "lastsave", "type", "multi", "exec", "discard", "sync", "flushdb", "flushall", "sort", "info", "monitor", "ttl", + "persist", "slaveof", "debug", "config", "subscribe", "unsubscribe", "psubscribe", "punsubscribe", "publish", "watch", "unwatch", "cluster", + "restore", "migrate", "dump", "object", "client", "eval", "evalsha"], require("./lib/commands")); + */ + + get(args:any[], callback?:ResCallbackT): void; + get(...args:any[]): void; + set(args:any[], callback?:ResCallbackT): void; + set(...args:any[]): void; + setnx(args:any[], callback?:ResCallbackT): void; + setnx(...args:any[]): void; + setex(args:any[], callback?:ResCallbackT): void; + setex(...args:any[]): void; + append(args:any[], callback?:ResCallbackT): void; + append(...args:any[]): void; + strlen(args:any[], callback?:ResCallbackT): void; + strlen(...args:any[]): void; + del(args:any[], callback?:ResCallbackT): void; + del(...args:any[]): void; + exists(args:any[], callback?:ResCallbackT): void; + exists(...args:any[]): void; + setbit(args:any[], callback?:ResCallbackT): void; + setbit(...args:any[]): void; + getbit(args:any[], callback?:ResCallbackT): void; + getbit(...args:any[]): void; + setrange(args:any[], callback?:ResCallbackT): void; + setrange(...args:any[]): void; + getrange(args:any[], callback?:ResCallbackT): void; + getrange(...args:any[]): void; + substr(args:any[], callback?:ResCallbackT): void; + substr(...args:any[]): void; + incr(args:any[], callback?:ResCallbackT): void; + incr(...args:any[]): void; + decr(args:any[], callback?:ResCallbackT): void; + decr(...args:any[]): void; + mget(args:any[], callback?:ResCallbackT): void; + mget(...args:any[]): void; + rpush(...args:any[]): void; + lpush(args:any[], callback?:ResCallbackT): void; + lpush(...args:any[]): void; + rpushx(args:any[], callback?:ResCallbackT): void; + rpushx(...args:any[]): void; + lpushx(args:any[], callback?:ResCallbackT): void; + lpushx(...args:any[]): void; + linsert(args:any[], callback?:ResCallbackT): void; + linsert(...args:any[]): void; + rpop(args:any[], callback?:ResCallbackT): void; + rpop(...args:any[]): void; + lpop(args:any[], callback?:ResCallbackT): void; + lpop(...args:any[]): void; + brpop(args:any[], callback?:ResCallbackT): void; + brpop(...args:any[]): void; + brpoplpush(args:any[], callback?:ResCallbackT): void; + brpoplpush(...args:any[]): void; + blpop(args:any[], callback?:ResCallbackT): void; + blpop(...args:any[]): void; + llen(args:any[], callback?:ResCallbackT): void; + llen(...args:any[]): void; + lindex(args:any[], callback?:ResCallbackT): void; + lindex(...args:any[]): void; + lset(args:any[], callback?:ResCallbackT): void; + lset(...args:any[]): void; + lrange(args:any[], callback?:ResCallbackT): void; + lrange(...args:any[]): void; + ltrim(args:any[], callback?:ResCallbackT): void; + ltrim(...args:any[]): void; + lrem(args:any[], callback?:ResCallbackT): void; + lrem(...args:any[]): void; + rpoplpush(args:any[], callback?:ResCallbackT): void; + rpoplpush(...args:any[]): void; + sadd(args:any[], callback?:ResCallbackT): void; + sadd(...args:any[]): void; + srem(args:any[], callback?:ResCallbackT): void; + srem(...args:any[]): void; + smove(args:any[], callback?:ResCallbackT): void; + smove(...args:any[]): void; + sismember(args:any[], callback?:ResCallbackT): void; + sismember(...args:any[]): void; + scard(args:any[], callback?:ResCallbackT): void; + scard(...args:any[]): void; + spop(args:any[], callback?:ResCallbackT): void; + spop(...args:any[]): void; + srandmember(args:any[], callback?:ResCallbackT): void; + srandmember(...args:any[]): void; + sinter(args:any[], callback?:ResCallbackT): void; + sinter(...args:any[]): void; + sinterstore(args:any[], callback?:ResCallbackT): void; + sinterstore(...args:any[]): void; + sunion(args:any[], callback?:ResCallbackT): void; + sunion(...args:any[]): void; + sunionstore(args:any[], callback?:ResCallbackT): void; + sunionstore(...args:any[]): void; + sdiff(args:any[], callback?:ResCallbackT): void; + sdiff(...args:any[]): void; + sdiffstore(args:any[], callback?:ResCallbackT): void; + sdiffstore(...args:any[]): void; + smembers(args:any[], callback?:ResCallbackT): void; + smembers(...args:any[]): void; + zadd(args:any[], callback?:ResCallbackT): void; + zadd(...args:any[]): void; + zincrby(args:any[], callback?:ResCallbackT): void; + zincrby(...args:any[]): void; + zrem(args:any[], callback?:ResCallbackT): void; + zrem(...args:any[]): void; + zremrangebyscore(args:any[], callback?:ResCallbackT): void; + zremrangebyscore(...args:any[]): void; + zremrangebyrank(args:any[], callback?:ResCallbackT): void; + zremrangebyrank(...args:any[]): void; + zunionstore(args:any[], callback?:ResCallbackT): void; + zunionstore(...args:any[]): void; + zinterstore(args:any[], callback?:ResCallbackT): void; + zinterstore(...args:any[]): void; + zrange(args:any[], callback?:ResCallbackT): void; + zrange(...args:any[]): void; + zrangebyscore(args:any[], callback?:ResCallbackT): void; + zrangebyscore(...args:any[]): void; + zrevrangebyscore(args:any[], callback?:ResCallbackT): void; + zrevrangebyscore(...args:any[]): void; + zcount(args:any[], callback?:ResCallbackT): void; + zcount(...args:any[]): void; + zrevrange(args:any[], callback?:ResCallbackT): void; + zrevrange(...args:any[]): void; + zcard(args:any[], callback?:ResCallbackT): void; + zcard(...args:any[]): void; + zscore(args:any[], callback?:ResCallbackT): void; + zscore(...args:any[]): void; + zrank(args:any[], callback?:ResCallbackT): void; + zrank(...args:any[]): void; + zrevrank(args:any[], callback?:ResCallbackT): void; + zrevrank(...args:any[]): void; + hset(args:any[], callback?:ResCallbackT): void; + hset(...args:any[]): void; + hsetnx(args:any[], callback?:ResCallbackT): void; + hsetnx(...args:any[]): void; + hget(args:any[], callback?:ResCallbackT): void; + hget(...args:any[]): void; + hmset(args:any[], callback?:ResCallbackT): void; + hmset(key:string, hash:any, callback?:ResCallbackT): void; + hmset(...args:any[]): void; + hmget(args:any[], callback?:ResCallbackT): void; + hmget(...args:any[]): void; + hincrby(args:any[], callback?:ResCallbackT): void; + hincrby(...args:any[]): void; + hdel(args:any[], callback?:ResCallbackT): void; + hdel(...args:any[]): void; + hlen(args:any[], callback?:ResCallbackT): void; + hlen(...args:any[]): void; + hkeys(args:any[], callback?:ResCallbackT): void; + hkeys(...args:any[]): void; + hvals(args:any[], callback?:ResCallbackT): void; + hvals(...args:any[]): void; + hgetall(args:any[], callback?:ResCallbackT): void; + hgetall(...args:any[]): void; + hgetall(key:string, callback?:ResCallbackT): void; + hexists(args:any[], callback?:ResCallbackT): void; + hexists(...args:any[]): void; + incrby(args:any[], callback?:ResCallbackT): void; + incrby(...args:any[]): void; + decrby(args:any[], callback?:ResCallbackT): void; + decrby(...args:any[]): void; + getset(args:any[], callback?:ResCallbackT): void; + getset(...args:any[]): void; + mset(args:any[], callback?:ResCallbackT): void; + mset(...args:any[]): void; + msetnx(args:any[], callback?:ResCallbackT): void; + msetnx(...args:any[]): void; + randomkey(args:any[], callback?:ResCallbackT): void; + randomkey(...args:any[]): void; + select(args:any[], callback?:ResCallbackT): void; + select(...args:any[]): void; + move(args:any[], callback?:ResCallbackT): void; + move(...args:any[]): void; + rename(args:any[], callback?:ResCallbackT): void; + rename(...args:any[]): void; + renamenx(args:any[], callback?:ResCallbackT): void; + renamenx(...args:any[]): void; + expire(args:any[], callback?:ResCallbackT): void; + expire(...args:any[]): void; + expireat(args:any[], callback?:ResCallbackT): void; + expireat(...args:any[]): void; + keys(args:any[], callback?:ResCallbackT): void; + keys(...args:any[]): void; + dbsize(args:any[], callback?:ResCallbackT): void; + dbsize(...args:any[]): void; + auth(args:any[], callback?:ResCallbackT): void; + auth(...args:any[]): void; + ping(args:any[], callback?:ResCallbackT): void; + ping(...args:any[]): void; + echo(args:any[], callback?:ResCallbackT): void; + echo(...args:any[]): void; + save(args:any[], callback?:ResCallbackT): void; + save(...args:any[]): void; + bgsave(args:any[], callback?:ResCallbackT): void; + bgsave(...args:any[]): void; + bgrewriteaof(args:any[], callback?:ResCallbackT): void; + bgrewriteaof(...args:any[]): void; + shutdown(args:any[], callback?:ResCallbackT): void; + shutdown(...args:any[]): void; + lastsave(args:any[], callback?:ResCallbackT): void; + lastsave(...args:any[]): void; + type(args:any[], callback?:ResCallbackT): void; + type(...args:any[]): void; + multi(args:any[], callback?:ResCallbackT): void; + multi(...args:any[]): void; + exec(args:any[], callback?:ResCallbackT): void; + exec(...args:any[]): void; + discard(args:any[], callback?:ResCallbackT): void; + discard(...args:any[]): void; + sync(args:any[], callback?:ResCallbackT): void; + sync(...args:any[]): void; + flushdb(args:any[], callback?:ResCallbackT): void; + flushdb(...args:any[]): void; + flushall(args:any[], callback?:ResCallbackT): void; + flushall(...args:any[]): void; + sort(args:any[], callback?:ResCallbackT): void; + sort(...args:any[]): void; + info(args:any[], callback?:ResCallbackT): void; + info(...args:any[]): void; + monitor(args:any[], callback?:ResCallbackT): void; + monitor(...args:any[]): void; + ttl(args:any[], callback?:ResCallbackT): void; + ttl(...args:any[]): void; + persist(args:any[], callback?:ResCallbackT): void; + persist(...args:any[]): void; + slaveof(args:any[], callback?:ResCallbackT): void; + slaveof(...args:any[]): void; + debug(args:any[], callback?:ResCallbackT): void; + debug(...args:any[]): void; + config(args:any[], callback?:ResCallbackT): void; + config(...args:any[]): void; + subscribe(args:any[], callback?:ResCallbackT): void; + subscribe(...args:any[]): void; + unsubscribe(args:any[], callback?:ResCallbackT): void; + unsubscribe(...args:any[]): void; + psubscribe(args:any[], callback?:ResCallbackT): void; + psubscribe(...args:any[]): void; + punsubscribe(args:any[], callback?:ResCallbackT): void; + punsubscribe(...args:any[]): void; + publish(args:any[], callback?:ResCallbackT): void; + publish(...args:any[]): void; + watch(args:any[], callback?:ResCallbackT): void; + watch(...args:any[]): void; + unwatch(args:any[], callback?:ResCallbackT): void; + unwatch(...args:any[]): void; + cluster(args:any[], callback?:ResCallbackT): void; + cluster(...args:any[]): void; + restore(args:any[], callback?:ResCallbackT): void; + restore(...args:any[]): void; + migrate(args:any[], callback?:ResCallbackT): void; + migrate(...args:any[]): void; + dump(args:any[], callback?:ResCallbackT): void; + dump(...args:any[]): void; + object(args:any[], callback?:ResCallbackT): void; + object(...args:any[]): void; + client(args:any[], callback?:ResCallbackT): void; + client(...args:any[]): void; + eval(args:any[], callback?:ResCallbackT): void; + eval(...args:any[]): void; + evalsha(args:any[], callback?:ResCallbackT): void; + evalsha(...args:any[]): void; + quit(args:any[], callback?:ResCallbackT): void; + quit(...args:any[]): void; + } } From f371b44439297704fa3cb738a3ea17797cdf1027 Mon Sep 17 00:00:00 2001 From: MugeSo Date: Thu, 20 Aug 2015 10:54:20 +0900 Subject: [PATCH 008/407] redis: add properties to ClientOpts interface --- redis/redis.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/redis/redis.d.ts b/redis/redis.d.ts index ec7220cee..886e285ca 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -39,12 +39,16 @@ declare module "redis" { return_buffers?: boolean; detect_buffers?: boolean; socket_nodelay?: boolean; + socket_keepalive?: boolean; no_ready_check?: boolean; enable_offline_queue?: boolean; retry_max_delay?: number; connect_timeout?: number; max_attempts?: number; auth_pass?: string; + family?: string; + command_queue_high_water?: number; + command_queue_low_water?: number; } interface RedisClient extends NodeJS.EventEmitter { From 0c3aa92a0b1d8da19600644123fc1652d8c87b1c Mon Sep 17 00:00:00 2001 From: MugeSo Date: Thu, 20 Aug 2015 11:24:21 +0900 Subject: [PATCH 009/407] redis: update tests --- redis/redis-tests.ts | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/redis/redis-tests.ts b/redis/redis-tests.ts index 9c7003541..b65cad599 100644 --- a/redis/redis-tests.ts +++ b/redis/redis-tests.ts @@ -4,6 +4,7 @@ import redis = require('redis'); var value: any; var valueArr: any[]; +var commandArr: any[][]; var num: number; var str: string; var bool: boolean; @@ -40,6 +41,7 @@ client.end(); // Connection (http://redis.io/commands#connection) client.auth(str, resCallback); client.ping(numCallback); +client.unref(); // Strings (http://redis.io/commands#strings) client.append(str, str, numCallback); @@ -49,9 +51,7 @@ client.set(str, str, strCallback); client.get(str, strCallback); client.exists(str, numCallback); -client.publish(str, value); -client.subscribe(str); - +// Event handlers client.on(str, messageHandler); client.once(str, messageHandler); @@ -62,5 +62,28 @@ client.get(args); client.get(args, resCallback); client.set(args); client.set(args, resCallback); +client.mset(args, resCallback); client.incr(str, resCallback); + +// Friendlier hash commands +client.hgetall(str, resCallback); +client.hmset(str, value, resCallback); +client.hmset(str, str, str, str, str, resCallback); + +// Publish / Subscribe +client.publish(str, value); +client.subscribe(str); + +// Multi +client.multi() + .scard(str) + .smembers(str) + .keys('*', resCallback) + .dbsize() + .exec(resCallback); + +client.multi(commandArr).exec(); + +// Monitor mode +client.monitor(resCallback); \ No newline at end of file From da1d0dcc70a919cd5e2ef29daec707b20d60bc65 Mon Sep 17 00:00:00 2001 From: MugeSo Date: Thu, 20 Aug 2015 11:27:08 +0900 Subject: [PATCH 010/407] redis: update tests --- redis/redis-tests.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/redis/redis-tests.ts b/redis/redis-tests.ts index b65cad599..5acb02465 100644 --- a/redis/redis-tests.ts +++ b/redis/redis-tests.ts @@ -86,4 +86,7 @@ client.multi() client.multi(commandArr).exec(); // Monitor mode -client.monitor(resCallback); \ No newline at end of file +client.monitor(resCallback); + +// Send command +client.send_command(str, args, resCallback); \ No newline at end of file From 9ae4d7f7bac138e262f9061843378a22b4298f44 Mon Sep 17 00:00:00 2001 From: MugeSo Date: Thu, 20 Aug 2015 11:44:58 +0900 Subject: [PATCH 011/407] redis: fix return value type of command methods. --- redis/redis.d.ts | 528 +++++++++++++++++++++++------------------------ 1 file changed, 264 insertions(+), 264 deletions(-) diff --git a/redis/redis.d.ts b/redis/redis.d.ts index 886e285ca..78d49499d 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -71,19 +71,19 @@ declare module "redis" { end(): void; // Connection (http://redis.io/commands#connection) - auth(password:string, callback?:ResCallbackT): void; - ping(callback?:ResCallbackT): void; + auth(password:string, callback?:ResCallbackT): boolean; + ping(callback?:ResCallbackT): boolean; // Strings (http://redis.io/commands#strings) - append(key:string, value:string, callback?:ResCallbackT): void; - bitcount(key:string, callback?:ResCallbackT): void; - bitcount(key:string, start:number, end:number, callback?:ResCallbackT): void; - set(key:string, value:string, callback?:ResCallbackT): void; - get(key:string, callback?:ResCallbackT): void; - exists(key:string, value:string, callback?:ResCallbackT): void; + append(key:string, value:string, callback?:ResCallbackT): boolean; + bitcount(key:string, callback?:ResCallbackT): boolean; + bitcount(key:string, start:number, end:number, callback?:ResCallbackT): boolean; + set(key:string, value:string, callback?:ResCallbackT): boolean; + get(key:string, callback?:ResCallbackT): boolean; + exists(key:string, value:string, callback?:ResCallbackT): boolean; - publish(channel:string, value:any): void; - subscribe(channel:string): void; + publish(channel:string, value:any): boolean; + subscribe(channel:string): boolean; /* commands = set_union([ @@ -99,262 +99,262 @@ declare module "redis" { "restore", "migrate", "dump", "object", "client", "eval", "evalsha"], require("./lib/commands")); */ - get(args:any[], callback?:ResCallbackT): void; - get(...args:any[]): void; - set(args:any[], callback?:ResCallbackT): void; - set(...args:any[]): void; - setnx(args:any[], callback?:ResCallbackT): void; - setnx(...args:any[]): void; - setex(args:any[], callback?:ResCallbackT): void; - setex(...args:any[]): void; - append(args:any[], callback?:ResCallbackT): void; - append(...args:any[]): void; - strlen(args:any[], callback?:ResCallbackT): void; - strlen(...args:any[]): void; - del(args:any[], callback?:ResCallbackT): void; - del(...args:any[]): void; - exists(args:any[], callback?:ResCallbackT): void; - exists(...args:any[]): void; - setbit(args:any[], callback?:ResCallbackT): void; - setbit(...args:any[]): void; - getbit(args:any[], callback?:ResCallbackT): void; - getbit(...args:any[]): void; - setrange(args:any[], callback?:ResCallbackT): void; - setrange(...args:any[]): void; - getrange(args:any[], callback?:ResCallbackT): void; - getrange(...args:any[]): void; - substr(args:any[], callback?:ResCallbackT): void; - substr(...args:any[]): void; - incr(args:any[], callback?:ResCallbackT): void; - incr(...args:any[]): void; - decr(args:any[], callback?:ResCallbackT): void; - decr(...args:any[]): void; - mget(args:any[], callback?:ResCallbackT): void; - mget(...args:any[]): void; - rpush(...args:any[]): void; - lpush(args:any[], callback?:ResCallbackT): void; - lpush(...args:any[]): void; - rpushx(args:any[], callback?:ResCallbackT): void; - rpushx(...args:any[]): void; - lpushx(args:any[], callback?:ResCallbackT): void; - lpushx(...args:any[]): void; - linsert(args:any[], callback?:ResCallbackT): void; - linsert(...args:any[]): void; - rpop(args:any[], callback?:ResCallbackT): void; - rpop(...args:any[]): void; - lpop(args:any[], callback?:ResCallbackT): void; - lpop(...args:any[]): void; - brpop(args:any[], callback?:ResCallbackT): void; - brpop(...args:any[]): void; - brpoplpush(args:any[], callback?:ResCallbackT): void; - brpoplpush(...args:any[]): void; - blpop(args:any[], callback?:ResCallbackT): void; - blpop(...args:any[]): void; - llen(args:any[], callback?:ResCallbackT): void; - llen(...args:any[]): void; - lindex(args:any[], callback?:ResCallbackT): void; - lindex(...args:any[]): void; - lset(args:any[], callback?:ResCallbackT): void; - lset(...args:any[]): void; - lrange(args:any[], callback?:ResCallbackT): void; - lrange(...args:any[]): void; - ltrim(args:any[], callback?:ResCallbackT): void; - ltrim(...args:any[]): void; - lrem(args:any[], callback?:ResCallbackT): void; - lrem(...args:any[]): void; - rpoplpush(args:any[], callback?:ResCallbackT): void; - rpoplpush(...args:any[]): void; - sadd(args:any[], callback?:ResCallbackT): void; - sadd(...args:any[]): void; - srem(args:any[], callback?:ResCallbackT): void; - srem(...args:any[]): void; - smove(args:any[], callback?:ResCallbackT): void; - smove(...args:any[]): void; - sismember(args:any[], callback?:ResCallbackT): void; - sismember(...args:any[]): void; - scard(args:any[], callback?:ResCallbackT): void; - scard(...args:any[]): void; - spop(args:any[], callback?:ResCallbackT): void; - spop(...args:any[]): void; - srandmember(args:any[], callback?:ResCallbackT): void; - srandmember(...args:any[]): void; - sinter(args:any[], callback?:ResCallbackT): void; - sinter(...args:any[]): void; - sinterstore(args:any[], callback?:ResCallbackT): void; - sinterstore(...args:any[]): void; - sunion(args:any[], callback?:ResCallbackT): void; - sunion(...args:any[]): void; - sunionstore(args:any[], callback?:ResCallbackT): void; - sunionstore(...args:any[]): void; - sdiff(args:any[], callback?:ResCallbackT): void; - sdiff(...args:any[]): void; - sdiffstore(args:any[], callback?:ResCallbackT): void; - sdiffstore(...args:any[]): void; - smembers(args:any[], callback?:ResCallbackT): void; - smembers(...args:any[]): void; - zadd(args:any[], callback?:ResCallbackT): void; - zadd(...args:any[]): void; - zincrby(args:any[], callback?:ResCallbackT): void; - zincrby(...args:any[]): void; - zrem(args:any[], callback?:ResCallbackT): void; - zrem(...args:any[]): void; - zremrangebyscore(args:any[], callback?:ResCallbackT): void; - zremrangebyscore(...args:any[]): void; - zremrangebyrank(args:any[], callback?:ResCallbackT): void; - zremrangebyrank(...args:any[]): void; - zunionstore(args:any[], callback?:ResCallbackT): void; - zunionstore(...args:any[]): void; - zinterstore(args:any[], callback?:ResCallbackT): void; - zinterstore(...args:any[]): void; - zrange(args:any[], callback?:ResCallbackT): void; - zrange(...args:any[]): void; - zrangebyscore(args:any[], callback?:ResCallbackT): void; - zrangebyscore(...args:any[]): void; - zrevrangebyscore(args:any[], callback?:ResCallbackT): void; - zrevrangebyscore(...args:any[]): void; - zcount(args:any[], callback?:ResCallbackT): void; - zcount(...args:any[]): void; - zrevrange(args:any[], callback?:ResCallbackT): void; - zrevrange(...args:any[]): void; - zcard(args:any[], callback?:ResCallbackT): void; - zcard(...args:any[]): void; - zscore(args:any[], callback?:ResCallbackT): void; - zscore(...args:any[]): void; - zrank(args:any[], callback?:ResCallbackT): void; - zrank(...args:any[]): void; - zrevrank(args:any[], callback?:ResCallbackT): void; - zrevrank(...args:any[]): void; - hset(args:any[], callback?:ResCallbackT): void; - hset(...args:any[]): void; - hsetnx(args:any[], callback?:ResCallbackT): void; - hsetnx(...args:any[]): void; - hget(args:any[], callback?:ResCallbackT): void; - hget(...args:any[]): void; - hmset(args:any[], callback?:ResCallbackT): void; - hmset(key:string, hash:any, callback?:ResCallbackT): void; - hmset(...args:any[]): void; - hmget(args:any[], callback?:ResCallbackT): void; - hmget(...args:any[]): void; - hincrby(args:any[], callback?:ResCallbackT): void; - hincrby(...args:any[]): void; - hdel(args:any[], callback?:ResCallbackT): void; - hdel(...args:any[]): void; - hlen(args:any[], callback?:ResCallbackT): void; - hlen(...args:any[]): void; - hkeys(args:any[], callback?:ResCallbackT): void; - hkeys(...args:any[]): void; - hvals(args:any[], callback?:ResCallbackT): void; - hvals(...args:any[]): void; - hgetall(args:any[], callback?:ResCallbackT): void; - hgetall(...args:any[]): void; - hgetall(key:string, callback?:ResCallbackT): void; - hexists(args:any[], callback?:ResCallbackT): void; - hexists(...args:any[]): void; - incrby(args:any[], callback?:ResCallbackT): void; - incrby(...args:any[]): void; - decrby(args:any[], callback?:ResCallbackT): void; - decrby(...args:any[]): void; - getset(args:any[], callback?:ResCallbackT): void; - getset(...args:any[]): void; - mset(args:any[], callback?:ResCallbackT): void; - mset(...args:any[]): void; - msetnx(args:any[], callback?:ResCallbackT): void; - msetnx(...args:any[]): void; - randomkey(args:any[], callback?:ResCallbackT): void; - randomkey(...args:any[]): void; + get(args:any[], callback?:ResCallbackT): boolean; + get(...args:any[]): boolean; + set(args:any[], callback?:ResCallbackT): boolean; + set(...args:any[]): boolean; + setnx(args:any[], callback?:ResCallbackT): boolean; + setnx(...args:any[]): boolean; + setex(args:any[], callback?:ResCallbackT): boolean; + setex(...args:any[]): boolean; + append(args:any[], callback?:ResCallbackT): boolean; + append(...args:any[]): boolean; + strlen(args:any[], callback?:ResCallbackT): boolean; + strlen(...args:any[]): boolean; + del(args:any[], callback?:ResCallbackT): boolean; + del(...args:any[]): boolean; + exists(args:any[], callback?:ResCallbackT): boolean; + exists(...args:any[]): boolean; + setbit(args:any[], callback?:ResCallbackT): boolean; + setbit(...args:any[]): boolean; + getbit(args:any[], callback?:ResCallbackT): boolean; + getbit(...args:any[]): boolean; + setrange(args:any[], callback?:ResCallbackT): boolean; + setrange(...args:any[]): boolean; + getrange(args:any[], callback?:ResCallbackT): boolean; + getrange(...args:any[]): boolean; + substr(args:any[], callback?:ResCallbackT): boolean; + substr(...args:any[]): boolean; + incr(args:any[], callback?:ResCallbackT): boolean; + incr(...args:any[]): boolean; + decr(args:any[], callback?:ResCallbackT): boolean; + decr(...args:any[]): boolean; + mget(args:any[], callback?:ResCallbackT): boolean; + mget(...args:any[]): boolean; + rpush(...args:any[]): boolean; + lpush(args:any[], callback?:ResCallbackT): boolean; + lpush(...args:any[]): boolean; + rpushx(args:any[], callback?:ResCallbackT): boolean; + rpushx(...args:any[]): boolean; + lpushx(args:any[], callback?:ResCallbackT): boolean; + lpushx(...args:any[]): boolean; + linsert(args:any[], callback?:ResCallbackT): boolean; + linsert(...args:any[]): boolean; + rpop(args:any[], callback?:ResCallbackT): boolean; + rpop(...args:any[]): boolean; + lpop(args:any[], callback?:ResCallbackT): boolean; + lpop(...args:any[]): boolean; + brpop(args:any[], callback?:ResCallbackT): boolean; + brpop(...args:any[]): boolean; + brpoplpush(args:any[], callback?:ResCallbackT): boolean; + brpoplpush(...args:any[]): boolean; + blpop(args:any[], callback?:ResCallbackT): boolean; + blpop(...args:any[]): boolean; + llen(args:any[], callback?:ResCallbackT): boolean; + llen(...args:any[]): boolean; + lindex(args:any[], callback?:ResCallbackT): boolean; + lindex(...args:any[]): boolean; + lset(args:any[], callback?:ResCallbackT): boolean; + lset(...args:any[]): boolean; + lrange(args:any[], callback?:ResCallbackT): boolean; + lrange(...args:any[]): boolean; + ltrim(args:any[], callback?:ResCallbackT): boolean; + ltrim(...args:any[]): boolean; + lrem(args:any[], callback?:ResCallbackT): boolean; + lrem(...args:any[]): boolean; + rpoplpush(args:any[], callback?:ResCallbackT): boolean; + rpoplpush(...args:any[]): boolean; + sadd(args:any[], callback?:ResCallbackT): boolean; + sadd(...args:any[]): boolean; + srem(args:any[], callback?:ResCallbackT): boolean; + srem(...args:any[]): boolean; + smove(args:any[], callback?:ResCallbackT): boolean; + smove(...args:any[]): boolean; + sismember(args:any[], callback?:ResCallbackT): boolean; + sismember(...args:any[]): boolean; + scard(args:any[], callback?:ResCallbackT): boolean; + scard(...args:any[]): boolean; + spop(args:any[], callback?:ResCallbackT): boolean; + spop(...args:any[]): boolean; + srandmember(args:any[], callback?:ResCallbackT): boolean; + srandmember(...args:any[]): boolean; + sinter(args:any[], callback?:ResCallbackT): boolean; + sinter(...args:any[]): boolean; + sinterstore(args:any[], callback?:ResCallbackT): boolean; + sinterstore(...args:any[]): boolean; + sunion(args:any[], callback?:ResCallbackT): boolean; + sunion(...args:any[]): boolean; + sunionstore(args:any[], callback?:ResCallbackT): boolean; + sunionstore(...args:any[]): boolean; + sdiff(args:any[], callback?:ResCallbackT): boolean; + sdiff(...args:any[]): boolean; + sdiffstore(args:any[], callback?:ResCallbackT): boolean; + sdiffstore(...args:any[]): boolean; + smembers(args:any[], callback?:ResCallbackT): boolean; + smembers(...args:any[]): boolean; + zadd(args:any[], callback?:ResCallbackT): boolean; + zadd(...args:any[]): boolean; + zincrby(args:any[], callback?:ResCallbackT): boolean; + zincrby(...args:any[]): boolean; + zrem(args:any[], callback?:ResCallbackT): boolean; + zrem(...args:any[]): boolean; + zremrangebyscore(args:any[], callback?:ResCallbackT): boolean; + zremrangebyscore(...args:any[]): boolean; + zremrangebyrank(args:any[], callback?:ResCallbackT): boolean; + zremrangebyrank(...args:any[]): boolean; + zunionstore(args:any[], callback?:ResCallbackT): boolean; + zunionstore(...args:any[]): boolean; + zinterstore(args:any[], callback?:ResCallbackT): boolean; + zinterstore(...args:any[]): boolean; + zrange(args:any[], callback?:ResCallbackT): boolean; + zrange(...args:any[]): boolean; + zrangebyscore(args:any[], callback?:ResCallbackT): boolean; + zrangebyscore(...args:any[]): boolean; + zrevrangebyscore(args:any[], callback?:ResCallbackT): boolean; + zrevrangebyscore(...args:any[]): boolean; + zcount(args:any[], callback?:ResCallbackT): boolean; + zcount(...args:any[]): boolean; + zrevrange(args:any[], callback?:ResCallbackT): boolean; + zrevrange(...args:any[]): boolean; + zcard(args:any[], callback?:ResCallbackT): boolean; + zcard(...args:any[]): boolean; + zscore(args:any[], callback?:ResCallbackT): boolean; + zscore(...args:any[]): boolean; + zrank(args:any[], callback?:ResCallbackT): boolean; + zrank(...args:any[]): boolean; + zrevrank(args:any[], callback?:ResCallbackT): boolean; + zrevrank(...args:any[]): boolean; + hset(args:any[], callback?:ResCallbackT): boolean; + hset(...args:any[]): boolean; + hsetnx(args:any[], callback?:ResCallbackT): boolean; + hsetnx(...args:any[]): boolean; + hget(args:any[], callback?:ResCallbackT): boolean; + hget(...args:any[]): boolean; + hmset(args:any[], callback?:ResCallbackT): boolean; + hmset(key:string, hash:any, callback?:ResCallbackT): boolean; + hmset(...args:any[]): boolean; + hmget(args:any[], callback?:ResCallbackT): boolean; + hmget(...args:any[]): boolean; + hincrby(args:any[], callback?:ResCallbackT): boolean; + hincrby(...args:any[]): boolean; + hdel(args:any[], callback?:ResCallbackT): boolean; + hdel(...args:any[]): boolean; + hlen(args:any[], callback?:ResCallbackT): boolean; + hlen(...args:any[]): boolean; + hkeys(args:any[], callback?:ResCallbackT): boolean; + hkeys(...args:any[]): boolean; + hvals(args:any[], callback?:ResCallbackT): boolean; + hvals(...args:any[]): boolean; + hgetall(args:any[], callback?:ResCallbackT): boolean; + hgetall(...args:any[]): boolean; + hgetall(key:string, callback?:ResCallbackT): boolean; + hexists(args:any[], callback?:ResCallbackT): boolean; + hexists(...args:any[]): boolean; + incrby(args:any[], callback?:ResCallbackT): boolean; + incrby(...args:any[]): boolean; + decrby(args:any[], callback?:ResCallbackT): boolean; + decrby(...args:any[]): boolean; + getset(args:any[], callback?:ResCallbackT): boolean; + getset(...args:any[]): boolean; + mset(args:any[], callback?:ResCallbackT): boolean; + mset(...args:any[]): boolean; + msetnx(args:any[], callback?:ResCallbackT): boolean; + msetnx(...args:any[]): boolean; + randomkey(args:any[], callback?:ResCallbackT): boolean; + randomkey(...args:any[]): boolean; select(args:any[], callback?:ResCallbackT): void; - select(...args:any[]): void; - move(args:any[], callback?:ResCallbackT): void; - move(...args:any[]): void; - rename(args:any[], callback?:ResCallbackT): void; - rename(...args:any[]): void; - renamenx(args:any[], callback?:ResCallbackT): void; - renamenx(...args:any[]): void; - expire(args:any[], callback?:ResCallbackT): void; - expire(...args:any[]): void; - expireat(args:any[], callback?:ResCallbackT): void; - expireat(...args:any[]): void; - keys(args:any[], callback?:ResCallbackT): void; - keys(...args:any[]): void; - dbsize(args:any[], callback?:ResCallbackT): void; - dbsize(...args:any[]): void; + select(...args:any[]): boolean; + move(args:any[], callback?:ResCallbackT): boolean; + move(...args:any[]): boolean; + rename(args:any[], callback?:ResCallbackT): boolean; + rename(...args:any[]): boolean; + renamenx(args:any[], callback?:ResCallbackT): boolean; + renamenx(...args:any[]): boolean; + expire(args:any[], callback?:ResCallbackT): boolean; + expire(...args:any[]): boolean; + expireat(args:any[], callback?:ResCallbackT): boolean; + expireat(...args:any[]): boolean; + keys(args:any[], callback?:ResCallbackT): boolean; + keys(...args:any[]): boolean; + dbsize(args:any[], callback?:ResCallbackT): boolean; + dbsize(...args:any[]): boolean; auth(args:any[], callback?:ResCallbackT): void; auth(...args:any[]): void; - ping(args:any[], callback?:ResCallbackT): void; - ping(...args:any[]): void; - echo(args:any[], callback?:ResCallbackT): void; - echo(...args:any[]): void; - save(args:any[], callback?:ResCallbackT): void; - save(...args:any[]): void; - bgsave(args:any[], callback?:ResCallbackT): void; - bgsave(...args:any[]): void; - bgrewriteaof(args:any[], callback?:ResCallbackT): void; - bgrewriteaof(...args:any[]): void; - shutdown(args:any[], callback?:ResCallbackT): void; - shutdown(...args:any[]): void; - lastsave(args:any[], callback?:ResCallbackT): void; - lastsave(...args:any[]): void; - type(args:any[], callback?:ResCallbackT): void; - type(...args:any[]): void; - multi(args:any[], callback?:ResCallbackT): void; - multi(...args:any[]): void; - exec(args:any[], callback?:ResCallbackT): void; - exec(...args:any[]): void; - discard(args:any[], callback?:ResCallbackT): void; - discard(...args:any[]): void; - sync(args:any[], callback?:ResCallbackT): void; - sync(...args:any[]): void; - flushdb(args:any[], callback?:ResCallbackT): void; - flushdb(...args:any[]): void; - flushall(args:any[], callback?:ResCallbackT): void; - flushall(...args:any[]): void; - sort(args:any[], callback?:ResCallbackT): void; - sort(...args:any[]): void; - info(args:any[], callback?:ResCallbackT): void; - info(...args:any[]): void; - monitor(args:any[], callback?:ResCallbackT): void; - monitor(...args:any[]): void; - ttl(args:any[], callback?:ResCallbackT): void; - ttl(...args:any[]): void; - persist(args:any[], callback?:ResCallbackT): void; - persist(...args:any[]): void; - slaveof(args:any[], callback?:ResCallbackT): void; - slaveof(...args:any[]): void; - debug(args:any[], callback?:ResCallbackT): void; - debug(...args:any[]): void; - config(args:any[], callback?:ResCallbackT): void; - config(...args:any[]): void; - subscribe(args:any[], callback?:ResCallbackT): void; - subscribe(...args:any[]): void; - unsubscribe(args:any[], callback?:ResCallbackT): void; - unsubscribe(...args:any[]): void; - psubscribe(args:any[], callback?:ResCallbackT): void; - psubscribe(...args:any[]): void; - punsubscribe(args:any[], callback?:ResCallbackT): void; - punsubscribe(...args:any[]): void; - publish(args:any[], callback?:ResCallbackT): void; - publish(...args:any[]): void; - watch(args:any[], callback?:ResCallbackT): void; - watch(...args:any[]): void; - unwatch(args:any[], callback?:ResCallbackT): void; - unwatch(...args:any[]): void; - cluster(args:any[], callback?:ResCallbackT): void; - cluster(...args:any[]): void; - restore(args:any[], callback?:ResCallbackT): void; - restore(...args:any[]): void; - migrate(args:any[], callback?:ResCallbackT): void; - migrate(...args:any[]): void; - dump(args:any[], callback?:ResCallbackT): void; - dump(...args:any[]): void; - object(args:any[], callback?:ResCallbackT): void; - object(...args:any[]): void; - client(args:any[], callback?:ResCallbackT): void; - client(...args:any[]): void; - eval(args:any[], callback?:ResCallbackT): void; - eval(...args:any[]): void; - evalsha(args:any[], callback?:ResCallbackT): void; - evalsha(...args:any[]): void; - quit(args:any[], callback?:ResCallbackT): void; - quit(...args:any[]): void; + ping(args:any[], callback?:ResCallbackT): boolean; + ping(...args:any[]): boolean; + echo(args:any[], callback?:ResCallbackT): boolean; + echo(...args:any[]): boolean; + save(args:any[], callback?:ResCallbackT): boolean; + save(...args:any[]): boolean; + bgsave(args:any[], callback?:ResCallbackT): boolean; + bgsave(...args:any[]): boolean; + bgrewriteaof(args:any[], callback?:ResCallbackT): boolean; + bgrewriteaof(...args:any[]): boolean; + shutdown(args:any[], callback?:ResCallbackT): boolean; + shutdown(...args:any[]): boolean; + lastsave(args:any[], callback?:ResCallbackT): boolean; + lastsave(...args:any[]): boolean; + type(args:any[], callback?:ResCallbackT): boolean; + type(...args:any[]): boolean; + multi(args:any[], callback?:ResCallbackT): boolean; + multi(...args:any[]): boolean; + exec(args:any[], callback?:ResCallbackT): boolean; + exec(...args:any[]): boolean; + discard(args:any[], callback?:ResCallbackT): boolean; + discard(...args:any[]): boolean; + sync(args:any[], callback?:ResCallbackT): boolean; + sync(...args:any[]): boolean; + flushdb(args:any[], callback?:ResCallbackT): boolean; + flushdb(...args:any[]): boolean; + flushall(args:any[], callback?:ResCallbackT): boolean; + flushall(...args:any[]): boolean; + sort(args:any[], callback?:ResCallbackT): boolean; + sort(...args:any[]): boolean; + info(args:any[], callback?:ResCallbackT): boolean; + info(...args:any[]): boolean; + monitor(args:any[], callback?:ResCallbackT): boolean; + monitor(...args:any[]): boolean; + ttl(args:any[], callback?:ResCallbackT): boolean; + ttl(...args:any[]): boolean; + persist(args:any[], callback?:ResCallbackT): boolean; + persist(...args:any[]): boolean; + slaveof(args:any[], callback?:ResCallbackT): boolean; + slaveof(...args:any[]): boolean; + debug(args:any[], callback?:ResCallbackT): boolean; + debug(...args:any[]): boolean; + config(args:any[], callback?:ResCallbackT): boolean; + config(...args:any[]): boolean; + subscribe(args:any[], callback?:ResCallbackT): boolean; + subscribe(...args:any[]): boolean; + unsubscribe(args:any[], callback?:ResCallbackT): boolean; + unsubscribe(...args:any[]): boolean; + psubscribe(args:any[], callback?:ResCallbackT): boolean; + psubscribe(...args:any[]): boolean; + punsubscribe(args:any[], callback?:ResCallbackT): boolean; + punsubscribe(...args:any[]): boolean; + publish(args:any[], callback?:ResCallbackT): boolean; + publish(...args:any[]): boolean; + watch(args:any[], callback?:ResCallbackT): boolean; + watch(...args:any[]): boolean; + unwatch(args:any[], callback?:ResCallbackT): boolean; + unwatch(...args:any[]): boolean; + cluster(args:any[], callback?:ResCallbackT): boolean; + cluster(...args:any[]): boolean; + restore(args:any[], callback?:ResCallbackT): boolean; + restore(...args:any[]): boolean; + migrate(args:any[], callback?:ResCallbackT): boolean; + migrate(...args:any[]): boolean; + dump(args:any[], callback?:ResCallbackT): boolean; + dump(...args:any[]): boolean; + object(args:any[], callback?:ResCallbackT): boolean; + object(...args:any[]): boolean; + client(args:any[], callback?:ResCallbackT): boolean; + client(...args:any[]): boolean; + eval(args:any[], callback?:ResCallbackT): boolean; + eval(...args:any[]): boolean; + evalsha(args:any[], callback?:ResCallbackT): boolean; + evalsha(...args:any[]): boolean; + quit(args:any[], callback?:ResCallbackT): boolean; + quit(...args:any[]): boolean; } } From 014ff4745d4b02f8408e5ba4f9dca8e5ea92893a Mon Sep 17 00:00:00 2001 From: MugeSo Date: Thu, 20 Aug 2015 12:04:33 +0900 Subject: [PATCH 012/407] redis: add Multi interface as a return value of RedisClient.mult() --- redis/redis.d.ts | 266 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 264 insertions(+), 2 deletions(-) diff --git a/redis/redis.d.ts b/redis/redis.d.ts index 78d49499d..444b91c4c 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -296,8 +296,8 @@ declare module "redis" { lastsave(...args:any[]): boolean; type(args:any[], callback?:ResCallbackT): boolean; type(...args:any[]): boolean; - multi(args:any[], callback?:ResCallbackT): boolean; - multi(...args:any[]): boolean; + multi(args:any[], callback?:ResCallbackT): Multi; + multi(...args:any[]): Multi; exec(args:any[], callback?:ResCallbackT): boolean; exec(...args:any[]): boolean; discard(args:any[], callback?:ResCallbackT): boolean; @@ -357,4 +357,266 @@ declare module "redis" { quit(args:any[], callback?:ResCallbackT): boolean; quit(...args:any[]): boolean; } + + interface Multi { + exec(callback?:ResCallbackT): boolean; + + get(args:any[], callback?:ResCallbackT): Multi; + get(...args:any[]): Multi; + set(args:any[], callback?:ResCallbackT): Multi; + set(...args:any[]): Multi; + setnx(args:any[], callback?:ResCallbackT): Multi; + setnx(...args:any[]): Multi; + setex(args:any[], callback?:ResCallbackT): Multi; + setex(...args:any[]): Multi; + append(args:any[], callback?:ResCallbackT): Multi; + append(...args:any[]): Multi; + strlen(args:any[], callback?:ResCallbackT): Multi; + strlen(...args:any[]): Multi; + del(args:any[], callback?:ResCallbackT): Multi; + del(...args:any[]): Multi; + exists(args:any[], callback?:ResCallbackT): Multi; + exists(...args:any[]): Multi; + setbit(args:any[], callback?:ResCallbackT): Multi; + setbit(...args:any[]): Multi; + getbit(args:any[], callback?:ResCallbackT): Multi; + getbit(...args:any[]): Multi; + setrange(args:any[], callback?:ResCallbackT): Multi; + setrange(...args:any[]): Multi; + getrange(args:any[], callback?:ResCallbackT): Multi; + getrange(...args:any[]): Multi; + substr(args:any[], callback?:ResCallbackT): Multi; + substr(...args:any[]): Multi; + incr(args:any[], callback?:ResCallbackT): Multi; + incr(...args:any[]): Multi; + decr(args:any[], callback?:ResCallbackT): Multi; + decr(...args:any[]): Multi; + mget(args:any[], callback?:ResCallbackT): Multi; + mget(...args:any[]): Multi; + rpush(...args:any[]): Multi; + lpush(args:any[], callback?:ResCallbackT): Multi; + lpush(...args:any[]): Multi; + rpushx(args:any[], callback?:ResCallbackT): Multi; + rpushx(...args:any[]): Multi; + lpushx(args:any[], callback?:ResCallbackT): Multi; + lpushx(...args:any[]): Multi; + linsert(args:any[], callback?:ResCallbackT): Multi; + linsert(...args:any[]): Multi; + rpop(args:any[], callback?:ResCallbackT): Multi; + rpop(...args:any[]): Multi; + lpop(args:any[], callback?:ResCallbackT): Multi; + lpop(...args:any[]): Multi; + brpop(args:any[], callback?:ResCallbackT): Multi; + brpop(...args:any[]): Multi; + brpoplpush(args:any[], callback?:ResCallbackT): Multi; + brpoplpush(...args:any[]): Multi; + blpop(args:any[], callback?:ResCallbackT): Multi; + blpop(...args:any[]): Multi; + llen(args:any[], callback?:ResCallbackT): Multi; + llen(...args:any[]): Multi; + lindex(args:any[], callback?:ResCallbackT): Multi; + lindex(...args:any[]): Multi; + lset(args:any[], callback?:ResCallbackT): Multi; + lset(...args:any[]): Multi; + lrange(args:any[], callback?:ResCallbackT): Multi; + lrange(...args:any[]): Multi; + ltrim(args:any[], callback?:ResCallbackT): Multi; + ltrim(...args:any[]): Multi; + lrem(args:any[], callback?:ResCallbackT): Multi; + lrem(...args:any[]): Multi; + rpoplpush(args:any[], callback?:ResCallbackT): Multi; + rpoplpush(...args:any[]): Multi; + sadd(args:any[], callback?:ResCallbackT): Multi; + sadd(...args:any[]): Multi; + srem(args:any[], callback?:ResCallbackT): Multi; + srem(...args:any[]): Multi; + smove(args:any[], callback?:ResCallbackT): Multi; + smove(...args:any[]): Multi; + sismember(args:any[], callback?:ResCallbackT): Multi; + sismember(...args:any[]): Multi; + scard(args:any[], callback?:ResCallbackT): Multi; + scard(...args:any[]): Multi; + spop(args:any[], callback?:ResCallbackT): Multi; + spop(...args:any[]): Multi; + srandmember(args:any[], callback?:ResCallbackT): Multi; + srandmember(...args:any[]): Multi; + sinter(args:any[], callback?:ResCallbackT): Multi; + sinter(...args:any[]): Multi; + sinterstore(args:any[], callback?:ResCallbackT): Multi; + sinterstore(...args:any[]): Multi; + sunion(args:any[], callback?:ResCallbackT): Multi; + sunion(...args:any[]): Multi; + sunionstore(args:any[], callback?:ResCallbackT): Multi; + sunionstore(...args:any[]): Multi; + sdiff(args:any[], callback?:ResCallbackT): Multi; + sdiff(...args:any[]): Multi; + sdiffstore(args:any[], callback?:ResCallbackT): Multi; + sdiffstore(...args:any[]): Multi; + smembers(args:any[], callback?:ResCallbackT): Multi; + smembers(...args:any[]): Multi; + zadd(args:any[], callback?:ResCallbackT): Multi; + zadd(...args:any[]): Multi; + zincrby(args:any[], callback?:ResCallbackT): Multi; + zincrby(...args:any[]): Multi; + zrem(args:any[], callback?:ResCallbackT): Multi; + zrem(...args:any[]): Multi; + zremrangebyscore(args:any[], callback?:ResCallbackT): Multi; + zremrangebyscore(...args:any[]): Multi; + zremrangebyrank(args:any[], callback?:ResCallbackT): Multi; + zremrangebyrank(...args:any[]): Multi; + zunionstore(args:any[], callback?:ResCallbackT): Multi; + zunionstore(...args:any[]): Multi; + zinterstore(args:any[], callback?:ResCallbackT): Multi; + zinterstore(...args:any[]): Multi; + zrange(args:any[], callback?:ResCallbackT): Multi; + zrange(...args:any[]): Multi; + zrangebyscore(args:any[], callback?:ResCallbackT): Multi; + zrangebyscore(...args:any[]): Multi; + zrevrangebyscore(args:any[], callback?:ResCallbackT): Multi; + zrevrangebyscore(...args:any[]): Multi; + zcount(args:any[], callback?:ResCallbackT): Multi; + zcount(...args:any[]): Multi; + zrevrange(args:any[], callback?:ResCallbackT): Multi; + zrevrange(...args:any[]): Multi; + zcard(args:any[], callback?:ResCallbackT): Multi; + zcard(...args:any[]): Multi; + zscore(args:any[], callback?:ResCallbackT): Multi; + zscore(...args:any[]): Multi; + zrank(args:any[], callback?:ResCallbackT): Multi; + zrank(...args:any[]): Multi; + zrevrank(args:any[], callback?:ResCallbackT): Multi; + zrevrank(...args:any[]): Multi; + hset(args:any[], callback?:ResCallbackT): Multi; + hset(...args:any[]): Multi; + hsetnx(args:any[], callback?:ResCallbackT): Multi; + hsetnx(...args:any[]): Multi; + hget(args:any[], callback?:ResCallbackT): Multi; + hget(...args:any[]): Multi; + hmset(args:any[], callback?:ResCallbackT): Multi; + hmset(key:string, hash:any, callback?:ResCallbackT): Multi; + hmset(...args:any[]): Multi; + hmget(args:any[], callback?:ResCallbackT): Multi; + hmget(...args:any[]): Multi; + hincrby(args:any[], callback?:ResCallbackT): Multi; + hincrby(...args:any[]): Multi; + hdel(args:any[], callback?:ResCallbackT): Multi; + hdel(...args:any[]): Multi; + hlen(args:any[], callback?:ResCallbackT): Multi; + hlen(...args:any[]): Multi; + hkeys(args:any[], callback?:ResCallbackT): Multi; + hkeys(...args:any[]): Multi; + hvals(args:any[], callback?:ResCallbackT): Multi; + hvals(...args:any[]): Multi; + hgetall(args:any[], callback?:ResCallbackT): Multi; + hgetall(...args:any[]): Multi; + hgetall(key:string, callback?:ResCallbackT): Multi; + hexists(args:any[], callback?:ResCallbackT): Multi; + hexists(...args:any[]): Multi; + incrby(args:any[], callback?:ResCallbackT): Multi; + incrby(...args:any[]): Multi; + decrby(args:any[], callback?:ResCallbackT): Multi; + decrby(...args:any[]): Multi; + getset(args:any[], callback?:ResCallbackT): Multi; + getset(...args:any[]): Multi; + mset(args:any[], callback?:ResCallbackT): Multi; + mset(...args:any[]): Multi; + msetnx(args:any[], callback?:ResCallbackT): Multi; + msetnx(...args:any[]): Multi; + randomkey(args:any[], callback?:ResCallbackT): Multi; + randomkey(...args:any[]): Multi; + select(args:any[], callback?:ResCallbackT): void; + select(...args:any[]): Multi; + move(args:any[], callback?:ResCallbackT): Multi; + move(...args:any[]): Multi; + rename(args:any[], callback?:ResCallbackT): Multi; + rename(...args:any[]): Multi; + renamenx(args:any[], callback?:ResCallbackT): Multi; + renamenx(...args:any[]): Multi; + expire(args:any[], callback?:ResCallbackT): Multi; + expire(...args:any[]): Multi; + expireat(args:any[], callback?:ResCallbackT): Multi; + expireat(...args:any[]): Multi; + keys(args:any[], callback?:ResCallbackT): Multi; + keys(...args:any[]): Multi; + dbsize(args:any[], callback?:ResCallbackT): Multi; + dbsize(...args:any[]): Multi; + auth(args:any[], callback?:ResCallbackT): void; + auth(...args:any[]): void; + ping(args:any[], callback?:ResCallbackT): Multi; + ping(...args:any[]): Multi; + echo(args:any[], callback?:ResCallbackT): Multi; + echo(...args:any[]): Multi; + save(args:any[], callback?:ResCallbackT): Multi; + save(...args:any[]): Multi; + bgsave(args:any[], callback?:ResCallbackT): Multi; + bgsave(...args:any[]): Multi; + bgrewriteaof(args:any[], callback?:ResCallbackT): Multi; + bgrewriteaof(...args:any[]): Multi; + shutdown(args:any[], callback?:ResCallbackT): Multi; + shutdown(...args:any[]): Multi; + lastsave(args:any[], callback?:ResCallbackT): Multi; + lastsave(...args:any[]): Multi; + type(args:any[], callback?:ResCallbackT): Multi; + type(...args:any[]): Multi; + multi(args:any[], callback?:ResCallbackT): Multi; + multi(...args:any[]): Multi; + exec(args:any[], callback?:ResCallbackT): Multi; + exec(...args:any[]): Multi; + discard(args:any[], callback?:ResCallbackT): Multi; + discard(...args:any[]): Multi; + sync(args:any[], callback?:ResCallbackT): Multi; + sync(...args:any[]): Multi; + flushdb(args:any[], callback?:ResCallbackT): Multi; + flushdb(...args:any[]): Multi; + flushall(args:any[], callback?:ResCallbackT): Multi; + flushall(...args:any[]): Multi; + sort(args:any[], callback?:ResCallbackT): Multi; + sort(...args:any[]): Multi; + info(args:any[], callback?:ResCallbackT): Multi; + info(...args:any[]): Multi; + monitor(args:any[], callback?:ResCallbackT): Multi; + monitor(...args:any[]): Multi; + ttl(args:any[], callback?:ResCallbackT): Multi; + ttl(...args:any[]): Multi; + persist(args:any[], callback?:ResCallbackT): Multi; + persist(...args:any[]): Multi; + slaveof(args:any[], callback?:ResCallbackT): Multi; + slaveof(...args:any[]): Multi; + debug(args:any[], callback?:ResCallbackT): Multi; + debug(...args:any[]): Multi; + config(args:any[], callback?:ResCallbackT): Multi; + config(...args:any[]): Multi; + subscribe(args:any[], callback?:ResCallbackT): Multi; + subscribe(...args:any[]): Multi; + unsubscribe(args:any[], callback?:ResCallbackT): Multi; + unsubscribe(...args:any[]): Multi; + psubscribe(args:any[], callback?:ResCallbackT): Multi; + psubscribe(...args:any[]): Multi; + punsubscribe(args:any[], callback?:ResCallbackT): Multi; + punsubscribe(...args:any[]): Multi; + publish(args:any[], callback?:ResCallbackT): Multi; + publish(...args:any[]): Multi; + watch(args:any[], callback?:ResCallbackT): Multi; + watch(...args:any[]): Multi; + unwatch(args:any[], callback?:ResCallbackT): Multi; + unwatch(...args:any[]): Multi; + cluster(args:any[], callback?:ResCallbackT): Multi; + cluster(...args:any[]): Multi; + restore(args:any[], callback?:ResCallbackT): Multi; + restore(...args:any[]): Multi; + migrate(args:any[], callback?:ResCallbackT): Multi; + migrate(...args:any[]): Multi; + dump(args:any[], callback?:ResCallbackT): Multi; + dump(...args:any[]): Multi; + object(args:any[], callback?:ResCallbackT): Multi; + object(...args:any[]): Multi; + client(args:any[], callback?:ResCallbackT): Multi; + client(...args:any[]): Multi; + eval(args:any[], callback?:ResCallbackT): Multi; + eval(...args:any[]): Multi; + evalsha(args:any[], callback?:ResCallbackT): Multi; + evalsha(...args:any[]): Multi; + quit(args:any[], callback?:ResCallbackT): Multi; + quit(...args:any[]): Multi; + } } From 907e23613e49fb5a979ee0e8cd0d8ad8b6f3cc43 Mon Sep 17 00:00:00 2001 From: MugeSo Date: Thu, 20 Aug 2015 12:05:49 +0900 Subject: [PATCH 013/407] redis: add missing methods to RedisClient --- redis/redis.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/redis/redis.d.ts b/redis/redis.d.ts index 444b91c4c..c7e068d47 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -69,6 +69,10 @@ declare module "redis" { server_info: ServerInfo; end(): void; + unref(): void; + + // Low level command execution + send_command(command:string, ...args:any[]): boolean; // Connection (http://redis.io/commands#connection) auth(password:string, callback?:ResCallbackT): boolean; From af84e7675e25c62cf5ea4f89ac002d5875490f3a Mon Sep 17 00:00:00 2001 From: MugeSo Date: Thu, 20 Aug 2015 12:10:23 +0900 Subject: [PATCH 014/407] redis: write redis version --- redis/redis.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redis/redis.d.ts b/redis/redis.d.ts index c7e068d47..4f8041681 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -1,4 +1,4 @@ -// Type definitions for redis +// Type definitions for redis 0.12.1 // Project: https://github.com/mranney/node_redis // Definitions by: Carlos Ballesteros Velasco , Peter Harris , TANAKA Koichi // Definitions: https://github.com/borisyankov/DefinitelyTyped From 83d5bc71bc6bffb4a43147ab062a7c64bccca63e Mon Sep 17 00:00:00 2001 From: MugeSo Date: Sat, 22 Aug 2015 00:27:06 +0900 Subject: [PATCH 015/407] redis: fix RedisClient.select returns void degraded in 9ae4d7f --- redis/redis.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redis/redis.d.ts b/redis/redis.d.ts index 4f8041681..0e0a0a8a0 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -267,7 +267,7 @@ declare module "redis" { randomkey(args:any[], callback?:ResCallbackT): boolean; randomkey(...args:any[]): boolean; select(args:any[], callback?:ResCallbackT): void; - select(...args:any[]): boolean; + select(...args:any[]): void; move(args:any[], callback?:ResCallbackT): boolean; move(...args:any[]): boolean; rename(args:any[], callback?:ResCallbackT): boolean; From 5760ad3aa8b50b38a95e5c009236d795b7b3962b Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 19 Aug 2015 05:09:15 +0500 Subject: [PATCH 016/407] lodash: added _.thru() method --- lodash/lodash-tests.ts | 42 ++++++++++++++++++++++++++-- lodash/lodash.d.ts | 62 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 98 insertions(+), 6 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 00ca144fd..a363b8ea5 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -403,9 +403,45 @@ result = _([1, 2]).zipWith(testZipWithFn, any).value(); result = _([1, 2]).zipWith([1, 2], testZipWithFn, any).value(); result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], testZipWithFn, any).value(); -// /* ************* -// * Collections * -// ************* */ +/********* + * Chain * + *********/ + +// _.thru +{ + let result: number; + result = _.thru(1, (value: number) => value); + result = _.thru(1, (value: number) => value, any); +} +{ + let result: _.LoDashWrapper; + result = _(1).thru((value: number) => value); + result = _(1).thru((value: number) => value, any); +} +{ + let result: _.LoDashWrapper; + result = _('').thru((value: string) => value); + result = _('').thru((value: string) => value, any); +} +{ + let result: _.LoDashWrapper; + result = _(true).thru((value: boolean) => value); + result = _(true).thru((value: boolean) => value, any); +} +{ + let result: _.LoDashObjectWrapper; + result = _({}).thru((value: Object) => value); + result = _({}).thru((value: Object) => value, any); +} +{ + let result: _.LoDashArrayWrapper; + result = _([1, 2, 3]).thru((value: number[]) => value); + result = _([1, 2, 3]).thru((value: number[]) => value, any); +} + +/************** + * Collection * + **************/ result = _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]); result = _.at(['moe', 'larry', 'curly'], 0, 2); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 77daeca2a..3436c48c4 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2000,9 +2000,65 @@ declare module _ { zipWith(...args: any[]): LoDashArrayWrapper; } - /* ************* - * Collections * - ************* */ + /********* + * Chain * + *********/ + + //_.thru + interface LoDashStatic { + /** + * This method is like _.tap except that it returns the result of interceptor. + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @param thisArg The this binding of interceptor. + * @return Returns the result of interceptor. + */ + thru( + value: T, + interceptor: (value: T) => TResult, + thisArg?: any): TResult; + } + + interface LoDashWrapperBase { + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashObjectWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult[], + thisArg?: any): LoDashArrayWrapper; + } + + /************** + * Collection * + **************/ //_.at interface LoDashStatic { From e491d5785627cddaede890386dc84272040c47fc Mon Sep 17 00:00:00 2001 From: Louis Lagrange Date: Thu, 27 Aug 2015 17:11:06 +0200 Subject: [PATCH 017/407] fix cordova-plugin-vibration Functions in interface Notification are deprecated and replaced with a function in interface Navigator --- cordova/plugins/Vibration.d.ts | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/cordova/plugins/Vibration.d.ts b/cordova/plugins/Vibration.d.ts index 715f6625f..65952f8e9 100644 --- a/cordova/plugins/Vibration.d.ts +++ b/cordova/plugins/Vibration.d.ts @@ -1,17 +1,32 @@ // Type definitions for Apache Cordova Vibration plugin. // Project: https://github.com/apache/cordova-plugin-vibration -// Definitions by: Microsoft Open Technologies, Inc. +// Definitions by: Microsoft Open Technologies, Inc. , Louis Lagrange // Definitions: https://github.com/borisyankov/DefinitelyTyped -// +// // Copyright (c) Microsoft Open Technologies, Inc. // Licensed under the MIT license. +interface Navigator { + /** + * Vibrates the device for the specified amount of time. + * @param time Milliseconds to vibrate the device. 0 cancels the vibration. Ignored on iOS. + */ + vibrate(time: number): void; + + /** + * Vibrates the device with a given pattern. + * @param time Sequence of durations (in milliseconds) for which to turn on or off the vibrator. Ignored on iOS. + */ + vibrate(time: number[]): void; +} + interface Notification { /** * Vibrates the device for the specified amount of time. * @param time Milliseconds to vibrate the device. Ignored on iOS. + * @deprecated */ - vibrate(time: number): void + vibrate(time: number): void; /** * Vibrates the device with a given pattern. * @param number[] pattern Pattern with which to vibrate the device. @@ -19,10 +34,12 @@ interface Notification { * The next value - the number of milliseconds for which to keep the vibrator on before turning it off. * @param number repeat Optional index into the pattern array at which to start repeating (will repeat until canceled), * or -1 for no repetition (default). + * @deprecated */ vibrateWithPattern(pattern: number[], repeat: number): void; /** * Immediately cancels any currently running vibration. + * @deprecated */ cancelVibration(): void; -} \ No newline at end of file +} From 989e5e7ada29f8e9e36460bc528875f008893226 Mon Sep 17 00:00:00 2001 From: Calvin Fernandez Date: Thu, 27 Aug 2015 17:43:24 -0400 Subject: [PATCH 018/407] add placholder parameter to work with codemirror placeholder addon --- codemirror/codemirror.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/codemirror/codemirror.d.ts b/codemirror/codemirror.d.ts index 06361684d..9bf5f3394 100644 --- a/codemirror/codemirror.d.ts +++ b/codemirror/codemirror.d.ts @@ -787,7 +787,10 @@ declare module CodeMirror { viewportMargin?: number; /** Optional lint configuration to be used in conjunction with CodeMirror's linter addon. */ - lint?: boolean | LintOptions; + lint?: boolean | LintOptions; + + /** Optional value to be used in conduction with CodeMirror’s placeholder add-on. */ + placeholder?: string; } interface TextMarkerOptions { From cf72a199fbe39230f548cda5b3de70bdead4d0dd Mon Sep 17 00:00:00 2001 From: matjos Date: Fri, 28 Aug 2015 11:36:44 +0200 Subject: [PATCH 019/407] Added ImageWMS constructor options. --- openlayers/openlayers.d.ts | 39 +++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index 39091a849..96b544cdc 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -88,6 +88,42 @@ declare module olx { targetSize?: number; } + interface ImageWMSOptions { + + /** Attributions. */ + attributions?: Array; + + /** The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you are using the WebGL renderer or if you want to access pixel data with the Canvas renderer. See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail. */ + crossOrigin?: string; + + /** experimental Use the ol.Map#pixelRatio value when requesting the image from the remote server. Default is true. */ + hidpi?: boolean; + + /** experimental The type of the remote WMS server: mapserver, geoserver or qgis. Only needed if hidpi is true. Default is undefined. */ + serverType?: any; + + /** experimental Optional function to load an image given a URL. */ + imageLoadFunction?: any; + + /** Logo. */ + logo?: any; + + /** WMS request parameters. At least a LAYERS param is required. STYLES is '' by default. VERSION is 1.3.0 by default. WIDTH, HEIGHT, BBOX and CRS (SRS for WMS version < 1.3.0) will be set dynamically. */ + params?: any; + + /** experimental Projection. */ + projection?: ol.proj.ProjectionLike; + /** Ratio. 1 means image requests are the size of the map viewport, 2 means twice the width and height of the map viewport, and so on. Must be 1 or higher. Default is 1.5. */ + ratio?: number; + + /** Resolutions. If specified, requests will be made for these resolutions only. */ + resolutions?: Array; + + /** WMS service URL. */ + url?: string; + } + + interface MapOptions { /** Controls initially added to the map. If not specified, ol.control.defaults() is used. */ @@ -2150,7 +2186,7 @@ declare module ol { * @param number Input between 0 and 1 * @returns Output between 0 and 1 */ - function inAndOut (t: number): number; + function inAndOut(t: number): number; /** * Maintain a constant speed over time. @@ -3112,6 +3148,7 @@ declare module ol { } class ImageWMS { + constructor(options: olx.ImageWMSOptions); } class MapQuest { From 9390bb6fe4251784708c7c301625846d396b30f0 Mon Sep 17 00:00:00 2001 From: matjos Date: Fri, 28 Aug 2015 16:18:15 +0200 Subject: [PATCH 020/407] Added TileWMS, Projection and refactored --- openlayers/openlayers.d.ts | 87 +++++++++++++++++++++++++++++++++----- 1 file changed, 76 insertions(+), 11 deletions(-) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index 96b544cdc..842ebfd5a 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -88,11 +88,14 @@ declare module olx { targetSize?: number; } - interface ImageWMSOptions { - + interface BaseWMSOptions { + /** Attributions. */ attributions?: Array; + /** WMS request parameters. At least a LAYERS param is required. STYLES is '' by default. VERSION is 1.3.0 by default. WIDTH, HEIGHT, BBOX and CRS (SRS for WMS version < 1.3.0) will be set dynamically. */ + params?: any; + /** The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you are using the WebGL renderer or if you want to access pixel data with the Canvas renderer. See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail. */ crossOrigin?: string; @@ -102,27 +105,48 @@ declare module olx { /** experimental The type of the remote WMS server: mapserver, geoserver or qgis. Only needed if hidpi is true. Default is undefined. */ serverType?: any; - /** experimental Optional function to load an image given a URL. */ - imageLoadFunction?: any; + /** WMS service URL. */ + url?: string; /** Logo. */ logo?: any; - /** WMS request parameters. At least a LAYERS param is required. STYLES is '' by default. VERSION is 1.3.0 by default. WIDTH, HEIGHT, BBOX and CRS (SRS for WMS version < 1.3.0) will be set dynamically. */ - params?: any; - /** experimental Projection. */ projection?: ol.proj.ProjectionLike; + } + + interface ImageWMSOptions extends BaseWMSOptions { + + /** experimental Optional function to load an image given a URL. */ + imageLoadFunction?: any; + /** Ratio. 1 means image requests are the size of the map viewport, 2 means twice the width and height of the map viewport, and so on. Must be 1 or higher. Default is 1.5. */ ratio?: number; /** Resolutions. If specified, requests will be made for these resolutions only. */ resolutions?: Array; - - /** WMS service URL. */ - url?: string; } + interface TileWMSOptions { + + /** The size in pixels of the gutter around image tiles to ignore. By setting this property to a non-zero value, images will be requested that are wider and taller than the tile size by a value of 2 x gutter. Defaults to zero. Using a non-zero value allows artifacts of rendering at tile edges to be ignored. If you control the WMS service it is recommended to address "artifacts at tile edges" issues by properly configuring the WMS service. For example, MapServer has a tile_map_edge_buffer configuration parameter for this. See http://mapserver.org/output/tile_mode.html. */ + gutter?: number; + + /** Tile grid. Base this on the resolutions, tilesize and extent supported by the server. If this is not defined, a default grid will be used: if there is a projection extent, the grid will be based on that; if not, a grid based on a global extent with origin at 0,0 will be used. */ + tileGrid?: ol.tilegrid.TileGrid; + + /** experimental Maximum zoom. */ + maxZoom?: number; + + /** experimental Optional function to load a tile given a URL. */ + tileLoadFunction?: any; //todo + + /** WMS service urls. Use this instead of url when the WMS supports multiple urls for GetMap requests. */ + urls?: Array; + + /** experimental Whether to wrap the world horizontally. When set to false, only one world will be rendered. When true, tiles will be requested for one world only, but they will be wrapped horizontally to render multiple worlds. The default is true. */ + wrapX?: boolean; + } interface MapOptions { @@ -279,6 +303,45 @@ declare module olx { rotation: number; } + interface Projection { + /** + * The SRS identifier code, e.g. EPSG:4326. + */ + code: string; + + /** + * Units. Required unless a proj4 projection is defined for code. + */ + units?: ol.proj.Units; + + /** + * The validity extent for the SRS. + */ + extent?: Array; + + /** + * The axis orientation as specified in Proj4. The default is enu. + */ + axisOrientation?: string; + + /** + * Whether the projection is valid for the whole globe. Default is false. + */ + global?: boolean; + + /** + * experimental The world extent for the SRS. + */ + worldExtent?: ol.Extent; + + /** + * experimental Function to determine resolution at a point. The function is called with + * a {number} view resolution and an {ol.Coordinate} as arguments, and returns the {number} + * resolution at the passed coordinate. + */ + getPointResolution?: any; + } + module animation { interface BounceOptions { @@ -3103,7 +3166,8 @@ declare module ol { */ function transformExtent(extent: Extent, source: ProjectionLike, destination: ProjectionLike): Extent; - interface Projection { + class Projection { + constructor(options: olx.Projection) } } @@ -3189,6 +3253,7 @@ declare module ol { } class TileWMS { + constructor(options: olx.TileWMSOptions); } class Vector { From a132dbfacf6491d421abb213e13cd1fd6f3c222b Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Sat, 29 Aug 2015 18:31:48 -0500 Subject: [PATCH 021/407] Replace Stream#_transform()s with single method with chunk: any --- node/node.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index 027c654ac..d02311e2f 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1728,8 +1728,7 @@ declare module "stream" { readable: boolean; writable: boolean; constructor(opts?: TransformOptions); - _transform(chunk: Buffer, encoding: string, callback: Function): void; - _transform(chunk: string, encoding: string, callback: Function): void; + _transform(chunk: any, encoding: string, callback: Function): void; _flush(callback: Function): void; read(size?: number): any; setEncoding(encoding: string): void; From 2c29e389777cb10534252334545d279a1663baa4 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Date: Sun, 30 Aug 2015 00:10:39 -0300 Subject: [PATCH 022/407] add better-curry --- better-curry/better-curry-tests.ts | 25 +++++++++++++++ better-curry/better-curry.d.ts | 50 ++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 better-curry/better-curry-tests.ts create mode 100644 better-curry/better-curry.d.ts diff --git a/better-curry/better-curry-tests.ts b/better-curry/better-curry-tests.ts new file mode 100644 index 000000000..15213d58b --- /dev/null +++ b/better-curry/better-curry-tests.ts @@ -0,0 +1,25 @@ +/// + +import bc = require('better-curry'); +bc.flatten([1,2,3,[1,2],['a']]) === []; +bc.MAX_OPTIMIZED = 5; + +function fn(...args: number[]): number[] { + return [].concat([1]); +} + +function fn2(arg1: string, arg2: any): number { + return parseInt(arg1 + String(arg2)) + 1; +} + +bc.predefine(fn, [1,2])() === []; +bc.predefine(fn, [1,2]).__length === 3; + +var f = bc.wrap(fn2, {}, 10, true); +f('1', 2) === 3; + +var delegate = bc.delegate({}, 'ok'); +delegate.access('ok') === delegate; +delegate.getter('getter').setter('setter') === delegate; +delegate.all(['1','2']); +delegate.revoke('adsf').access('asdf'); \ No newline at end of file diff --git a/better-curry/better-curry.d.ts b/better-curry/better-curry.d.ts new file mode 100644 index 000000000..59ebe0a37 --- /dev/null +++ b/better-curry/better-curry.d.ts @@ -0,0 +1,50 @@ +// Type definitions for better-curry +// Project: https://github.com/pocesar/js-bettercurry +// Definitions by: Paulo Cesar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var BetterCurry: BetterCurryModule.BetterCurry; + +declare module BetterCurryModule { + + export interface DelegateOptions { + as?: string; + len?: number; + args?: any[]; + name?: string; + } + + export class Delegate { + proto: T; + target: string; + methods: any[]; + getters: any[]; + setters: any[]; + all: (skip?: string[]) => void; + method: (name: string|DelegateOptions) => Delegate; + getter: (name: string|DelegateOptions) => Delegate; + setter: (name: string|DelegateOptions) => Delegate; + access: (name: string|DelegateOptions) => Delegate; + revoke: (name: string) => Delegate; + constructor(proto: T, target: string); + } + + export interface OriginalFunctionReminder extends Function { + __length: number; + } + + export interface BetterCurry { + predefine: (fn: T, args: any[], context?: Object, len?: number, checkArguments?: boolean) => OriginalFunctionReminder; + wrap: (fn: T, context?: Object, len?: number, checkArguments?: boolean) => OriginalFunctionReminder; + flatten: (...args: Array|any>) => any[]; + delegate: (proto: T, target: string) => Delegate; + MAX_OPTIMIZED: number; + } + +} + +declare module 'better-curry' { + var bc: BetterCurryModule.BetterCurry; + + export = bc; +} \ No newline at end of file From 10c0f2aadf2255a9f8c14c2cb489c0105c8d5419 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Date: Sun, 30 Aug 2015 00:17:20 -0300 Subject: [PATCH 023/407] add global to tests --- better-curry/better-curry-tests.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/better-curry/better-curry-tests.ts b/better-curry/better-curry-tests.ts index 15213d58b..ba95326f5 100644 --- a/better-curry/better-curry-tests.ts +++ b/better-curry/better-curry-tests.ts @@ -22,4 +22,6 @@ var delegate = bc.delegate({}, 'ok'); delegate.access('ok') === delegate; delegate.getter('getter').setter('setter') === delegate; delegate.all(['1','2']); -delegate.revoke('adsf').access('asdf'); \ No newline at end of file +delegate.revoke('adsf').access('asdf'); + +BetterCurry.wrap(fn2, {}, -1, false).__length === 10; \ No newline at end of file From a568ce93455b6fa6d7a229673bd37e801552ccb2 Mon Sep 17 00:00:00 2001 From: Artem Kozlov Date: Mon, 31 Aug 2015 10:42:56 +0200 Subject: [PATCH 024/407] typeahead. Allow funtction as displayKey. --- typeahead/typeahead.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index 159caaacd..7317aa4c7 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -119,8 +119,8 @@ declare module Twitter.Typeahead { * For a given suggestion object, determines the string representation of it. * This will be used when setting the value of the input control after a suggestion is selected. Can be either a key string or a function that transforms a suggestion object into a string. * Defaults to value. - */ - displayKey?: string; + */ + displayKey?: string | ((obj: any) => string); /** * A hash of templates to be used when rendering the dataset. From dab752b34ffd99eae12701afab4c97130638b03e Mon Sep 17 00:00:00 2001 From: benishouga Date: Tue, 1 Sep 2015 02:16:04 +0900 Subject: [PATCH 025/407] Link inherit HtmlAttribute for use with className and style --- react-router/react-router.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index f43f56484..cc071506f 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -114,13 +114,12 @@ declare module ReactRouter { // Components // ---------------------------------------------------------------------- // Link - interface LinkProp { + interface LinkProp extends React.HTMLAttributes { activeClassName?: string; activeStyle?: {}; to: string; params?: {}; query?: {}; - onClick?: Function; } interface Link extends React.ReactElement, Navigation, State { handleClick(event: any): void; From 5075a34165a0d6859a7d7d7b602dfdbf266a74bf Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 18 Aug 2015 20:56:24 +0500 Subject: [PATCH 026/407] lodash: trim trailing whitespace characters --- lodash/lodash.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 9815f472b..51a42c8da 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -694,9 +694,9 @@ declare module _ { takeWhile( array: (Array|List), predicate?: ListIterator, - thisArg?: any + thisArg?: any ): T[]; - + /** * Takes the first items from an array or list based on a predicate * @param array The array or list of items on which the result set will be based @@ -706,7 +706,7 @@ declare module _ { array: (Array|List), pluckValue: string ): any[]; - + /** * Takes the first items from an array or list based on a predicate * @param array The array or list of items on which the result set will be based @@ -1502,7 +1502,7 @@ declare module _ { **/ union(...arrays: List[]): T[]; } - + interface LoDashArrayWrapper { /** * @see _.union @@ -2514,13 +2514,13 @@ declare module _ { /** * Iterates over elements of a collection, returning an array of all elements the * identity function returns truey for. - * + * * @param collection The collection to iterate over. * @return Returns a new array of elements that passed the callback check. **/ filter( collection: (Array|List)): T[]; - + /** * Iterates over elements of a collection, returning an array of all elements the * callback returns truey for. The callback is bound to thisArg and invoked with three @@ -2683,7 +2683,7 @@ declare module _ { * @see _.filter **/ filter(): LoDashArrayWrapper; - + /** * @see _.filter **/ @@ -5096,7 +5096,7 @@ declare module _ { sortBy( collection: List, whereValue: W): T[]; - + /** * Sorts by all the given arguments, using either ListIterator, pluckValue, or whereValue foramts * @param args The rules by which to sort @@ -5126,7 +5126,7 @@ declare module _ { * @param whereValue _.where style callback **/ sortBy(whereValue: W): LoDashArrayWrapper; - + /** * Sorts by all the given arguments, using either ListIterator, pluckValue, or whereValue foramts * @param args The rules by which to sort From 473b16861966e1e79a26615f5c1839203895fa92 Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Tue, 1 Sep 2015 11:13:55 +0200 Subject: [PATCH 027/407] =?UTF-8?q?-=20update=20namespace=20of=20angular?= =?UTF-8?q?=20to=20=C2=ABangular=C2=BB=20instead=20of=20=C2=ABng=C2=BB,=20?= =?UTF-8?q?newer=20versions=20don't=20support=20=C2=ABng=C2=BB=20anymore?= =?UTF-8?q?=20-=20include=20static=20interface=20inside=20the=20module=20f?= =?UTF-8?q?ollowing=20the=20style=20how=20angularjs=20does=20it=20-=20refa?= =?UTF-8?q?ctor=20module=20name=20to=20use=20lowercase=20following=20angul?= =?UTF-8?q?arjs=20naming-style?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- angulartics/angulartics-tests.ts | 5 ++--- angulartics/angulartics.d.ts | 15 +++++++-------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/angulartics/angulartics-tests.ts b/angulartics/angulartics-tests.ts index cc816a2ab..af6eb52a3 100644 --- a/angulartics/angulartics-tests.ts +++ b/angulartics/angulartics-tests.ts @@ -3,7 +3,7 @@ module Analytics { angular.module("angulartics.app", ["angulartics"]) - .config(["$analyticsProvider", ($analyticsProvider: Angulartics.IAnalyticsServiceProvider) => { + .config(["$analyticsProvider", ($analyticsProvider:angulartics.IAnalyticsServiceProvider) => { angulartics.waitForVendorApi("location", 1000, (message: string) => { console.log(message); }); @@ -17,9 +17,8 @@ module Analytics { console.log(action); }); - $analyticsProvider.registerPageTrack((path: string, locationObj: ng.ILocationService) => { + $analyticsProvider.registerPageTrack((path:string, locationObj:angular.ILocationService) => { console.log("viewed " + path); }); }]); } - diff --git a/angulartics/angulartics.d.ts b/angulartics/angulartics.d.ts index 8c8957569..706ee6713 100644 --- a/angulartics/angulartics.d.ts +++ b/angulartics/angulartics.d.ts @@ -4,16 +4,15 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +declare module angulartics { -interface Angulartics { - waitForVendorApi(objectName: string, delay: number, containsField?: any, registerFn?: any, onTimeout?: boolean): void; -} - -declare module Angulartics { + interface IAngularticsStatic { + waitForVendorApi(objectName:string, delay:number, containsField?:any, registerFn?:any, onTimeout?:boolean): void; + } interface IAnalyticsService { eventTrack(eventName: string, properties?: any): any; - pageTrack(path: string, location?: ng.ILocationService): any; + pageTrack(path:string, location?:angular.ILocationService): any; setAlias(alias: string): any; setUsername(username: string): any; setUserProperties(properties: any): any; @@ -27,7 +26,7 @@ declare module Angulartics { withAutoBase(value: boolean): void; developerMode(value: boolean): void; - registerPageTrack(callback: (path: string, location?: ng.ILocationService) => any): void; + registerPageTrack(callback:(path:string, location?:angular.ILocationService) => any): void; registerEventTrack(callback: (eventName: string, properties?: any) => any): void; registerSetAlias(callback: (alias: string) => any): void registerSetUsername(callback: (username: string) => any): void @@ -36,4 +35,4 @@ declare module Angulartics { } } -declare var angulartics:Angulartics; +declare var angulartics:angulartics.IAngularticsStatic; From 29cb387b6987e8c4dadf1605d827a137a643db94 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 2 Sep 2015 17:48:04 +0200 Subject: [PATCH 028/407] removed ng-dialog from master --- ng-dialog/ng-dialog-tests.ts | 52 ----------------- ng-dialog/ng-dialog.d.ts | 105 ----------------------------------- 2 files changed, 157 deletions(-) delete mode 100644 ng-dialog/ng-dialog-tests.ts delete mode 100644 ng-dialog/ng-dialog.d.ts diff --git a/ng-dialog/ng-dialog-tests.ts b/ng-dialog/ng-dialog-tests.ts deleted file mode 100644 index 52b33212a..000000000 --- a/ng-dialog/ng-dialog-tests.ts +++ /dev/null @@ -1,52 +0,0 @@ -/// -/// - -var app = angular.module('testModule', ['ngDialog']); - -class DialogTestController { - - constructor(ngDialog: angular.dialog.IDialogService) { - - ngDialog.close("login-popup", "bye"); - ngDialog.closeAll("bye"); - - var defaults = ngDialog.getDefaults(); - - var dialogs = ngDialog.getOpenDialogs(); - - ngDialog.isOpen("bye"); - - var loginDialog = ngDialog.open({ - template: "login.html", - className: "default flat-ui", - closeByEscape: false, - name: "login-popup" - }); - - if (loginDialog.id === "login-popup") { - loginDialog.close("closing"); - } - - var deleteConfirm = ngDialog.openConfirm({ - template: "confirm.html" - }); - } -} - -class LoginDialogController { - - constructor($scope: angular.dialog.IDialogScope) { - - $scope.closeThisDialog("bye"); - } -} - -app.controller('TestController', DialogTestController); - -app.config((ngDialogProvider: angular.dialog.IDialogProvider) => { - - ngDialogProvider.setDefaults({ - className: "flat-ui" - }) - -}); \ No newline at end of file diff --git a/ng-dialog/ng-dialog.d.ts b/ng-dialog/ng-dialog.d.ts deleted file mode 100644 index a167aee47..000000000 --- a/ng-dialog/ng-dialog.d.ts +++ /dev/null @@ -1,105 +0,0 @@ -// Type definitions for ngDialog -// Project: https://github.com/likeastore/ngDialog -// Definitions by: Stephen Lautier -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module angular.dialog { - - interface IDialogService { - getDefaults(): IDialogOptions; - open(options: IDialogOpenOptions): IDialogOpenResult; - openConfirm(options: IDialogOpenOptions): IPromise; - - /** - * Determine whether the specified dialog is open or not. - * @param id Dialog id to check for. - * @returns {boolean} Indicating whether it exists or not. - */ - isOpen(id: string): boolean; - close(id: string, value: any); - closeAll(value: any); - getOpenDialogs(); - } - - interface IDialogOpenResult { - id: string; - close: Function; - closePromise: IPromise; - } - - interface IDialogProvider extends angular.IServiceProvider { - /** - * Default options for the dialogs. - * @param defaultOptions - * @returns {} - */ - setDefaults(defaultOptions: IDialogOptions): void; - } - - /** - * Dialog Scope which extends the $scope. - */ - interface IDialogScope extends angular.IScope { - /** - * This allows you to close dialog straight from handler in a popup element. - * @param value Any value passed to this function will be attached to the object which resolves on the close promise for this dialog. - * For dialogs opened with the openConfirm() method the value is used as the reject reason. - */ - closeThisDialog(value: any): void; - } - - interface IDialogOptions { - /** - * This option allows you to control the dialog's look, you can use built-in themes or create your own styled modals. - * It will be appended with the "ngdialog" class e.g. className is "default-theme flat-ui" it will be class="ngdialog default-theme flat-ui". - */ - className?: string; - /** - * If false it allows to hide overlay div behind the modals, default true. - */ - overlay?: boolean; - - /** - * If false it allows to hide close button on modals, default true. - */ - showClose?: boolean; - - /** - * It allows to close modals by clicking Esc button, default true. - * This will close all open modals if there several of them open at the same time. - */ - closeByEscape?: boolean; - - /** - * It allows to close modals by clicking on overlay background, default true. If @see Hammer.js is loaded, it will listen for tap instead of click. - */ - closeByDocument?: boolean; - - /** - * If true allows to use plain string as template, default false. - */ - plain?: boolean; - - /** - * Give a name for a dialog instance. It is useful for identifying specific dialog if there are multiple dialog boxes opened. - */ - name?: string | number; - - preCloseCallback?: string|Function; - } - - /** - * Options which are provided to open a dialog. - */ - interface IDialogOpenOptions extends IDialogOptions { - template: string; - controller?: string|any; - controllerAs?: string; - /** - * Scope object that will be passed to dialog. If you use controller with separate $scope service this object will be passed to $scope.$parent param. - */ - scope?: ng.IScope; - } -} \ No newline at end of file From b59f3d5c363317a0816a31903a83a5abbe19ff59 Mon Sep 17 00:00:00 2001 From: tkQubo Date: Thu, 3 Sep 2015 03:19:04 +0900 Subject: [PATCH 029/407] Add gulp-gzip --- gulp-gzip/gulp-gzip-tests.ts | 27 +++++++++++++++++++++ gulp-gzip/gulp-gzip.d.ts | 47 ++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 gulp-gzip/gulp-gzip-tests.ts create mode 100644 gulp-gzip/gulp-gzip.d.ts diff --git a/gulp-gzip/gulp-gzip-tests.ts b/gulp-gzip/gulp-gzip-tests.ts new file mode 100644 index 000000000..295e98b7f --- /dev/null +++ b/gulp-gzip/gulp-gzip-tests.ts @@ -0,0 +1,27 @@ +/// +/// + +import gulp = require('gulp'); +import gzip = require('gulp-gzip'); + +gzip({ append: true }); + +gzip({ extension: 'zip' }); // note that the `.` should not be included in the extension + +gzip({ preExtension: 'gz' }); // note that the `.` should not be included in the extension + +gzip({ threshold: '1kb' }); + +gzip({ threshold: 1024 }); + +gzip({ threshold: true }); + +gzip({ gzipOptions: { level: 9 } }); + +gzip({ gzipOptions: { memLevel: 1 } }); + +gulp.task('compress', function() { + gulp.src('./dev/scripts/*.js') + .pipe(gzip()) + .pipe(gulp.dest('./public/scripts')); +}); diff --git a/gulp-gzip/gulp-gzip.d.ts b/gulp-gzip/gulp-gzip.d.ts new file mode 100644 index 000000000..8711153ed --- /dev/null +++ b/gulp-gzip/gulp-gzip.d.ts @@ -0,0 +1,47 @@ +// Type definitions for gulp-gzip +// Project: https://github.com/jstuckey/gulp-gzip +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "gulp-gzip" { + import zlib = require('zlib'); + + namespace gzip { + interface Gzip { + (options?: Options): NodeJS.ReadWriteStream; + } + + interface Options { + /** + * Appends .gz file extension if true. + * @default true + */ + append?: boolean; + /** + * Appends an arbitrary extension to the filename. Disables append and preExtension options. + */ + extension?: string; + /** + * Appends an arbitrary pre-extension to the filename. Disables append and extension options. + */ + preExtension?: string; + /** + * Minimum size required to compress a file. + * @default false + */ + threshold?: number|string|boolean; + /** + * Options object to pass through to zlib.Gzip. + * See zlib documentation for more information. + */ + gzipOptions?: zlib.ZlibOptions; + } + } + + var gzip: gzip.Gzip; + + export = gzip; +} + From 9f0231e58e9e1b7b8d2102630c7d688fd1a473bf Mon Sep 17 00:00:00 2001 From: matjos Date: Wed, 2 Sep 2015 21:05:30 +0200 Subject: [PATCH 030/407] added tests to openlayers input --- openlayers/openlayers-tests.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/openlayers/openlayers-tests.ts b/openlayers/openlayers-tests.ts index 3effa928a..009273746 100644 --- a/openlayers/openlayers-tests.ts +++ b/openlayers/openlayers-tests.ts @@ -34,6 +34,7 @@ var geometry: ol.geom.Geometry; var loadingstrategy: ol.LoadingStrategy; var tilegrid: ol.tilegrid.TileGrid; var vector: ol.source.Vector; +var projection: ol.proj.Projection; // // ol.Attribution @@ -161,7 +162,9 @@ var tileLayer: ol.layer.Tile = new ol.layer.Tile({ // // ol.proj // -var projection: ol.proj.Projection; +projection = new ol.proj.Projection({ + code:stringValue, +}); // // ol.Map @@ -174,6 +177,21 @@ var map: ol.Map = new ol.Map({ }); map.beforeRender(preRenderFunction); +// +// ol.source.ImageWMS +// +var imageWMS: ol.source.ImageWMS = new ol.source.ImageWMS({ + serverType: stringValue, + url:stringValue +}); +// +// ol.source.TileWMS +// +var tileWMS: ol.source.TileWMS = new ol.source.TileWMS({ + serverType: stringValue, + url:stringValue +}); + // // ol.animation // From c1592cc0ad3e8cc64cb222fa4ad76ad80a42d0a8 Mon Sep 17 00:00:00 2001 From: matjos Date: Wed, 2 Sep 2015 22:07:57 +0200 Subject: [PATCH 031/407] Removed unnecesery any definitions. --- openlayers/openlayers.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index eb51c27a1..d7099c85f 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -103,13 +103,13 @@ declare module olx { hidpi?: boolean; /** experimental The type of the remote WMS server: mapserver, geoserver or qgis. Only needed if hidpi is true. Default is undefined. */ - serverType?: any; + serverType?: ol.source.wms.ServerType; /** WMS service URL. */ url?: string; /** Logo. */ - logo?: any; + logo?: olx.LogoOptions; /** experimental Projection. */ projection?: ol.proj.ProjectionLike; From 6612806e0a1be58b4cfe37775c0f48ec3809fcfd Mon Sep 17 00:00:00 2001 From: Paul Spears Date: Wed, 2 Sep 2015 16:01:05 -0500 Subject: [PATCH 032/407] Added missing types, updated tests This is a fix for issue #5652 https://github.com/borisyankov/DefinitelyTyped/issues/5652 --- angular-ui-router/angular-ui-router-tests.ts | 2 ++ angular-ui-router/angular-ui-router.d.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/angular-ui-router/angular-ui-router-tests.ts b/angular-ui-router/angular-ui-router-tests.ts index dccd8f7b1..7a1bc2d00 100644 --- a/angular-ui-router/angular-ui-router-tests.ts +++ b/angular-ui-router/angular-ui-router-tests.ts @@ -158,7 +158,9 @@ class UrlLocatorTestService implements IUrlLocatorTestService { private stateServiceTest() { this.$state.go("myState"); + this.$state.go(this.$state.current); this.$state.transitionTo("myState"); + this.$state.transitionTo(this.$state.current); if (this.$state.includes("myState") === true) { // } diff --git a/angular-ui-router/angular-ui-router.d.ts b/angular-ui-router/angular-ui-router.d.ts index febe1c090..ff0d6ce7e 100644 --- a/angular-ui-router/angular-ui-router.d.ts +++ b/angular-ui-router/angular-ui-router.d.ts @@ -228,8 +228,11 @@ declare module angular.ui { * @param options Options object. */ go(to: string, params?: {}, options?: IStateOptions): angular.IPromise; + go(to: IState, params?: {}, options?: IStateOptions): angular.IPromise; transitionTo(state: string, params?: {}, updateLocation?: boolean): void; + transitionTo(state: IState, params?: {}, updateLocation?: boolean): void; transitionTo(state: string, params?: {}, options?: IStateOptions): void; + transitionTo(state: IState, params?: {}, options?: IStateOptions): void; includes(state: string, params?: {}): boolean; is(state:string, params?: {}): boolean; is(state: IState, params?: {}): boolean; From 133698acc7df8b22c43a22a433ab1ea02c0d4fee Mon Sep 17 00:00:00 2001 From: matjos Date: Wed, 2 Sep 2015 23:10:18 +0200 Subject: [PATCH 033/407] Replaced any with correct methods --- openlayers/openlayers.d.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index d7099c85f..782ecaea0 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -118,7 +118,7 @@ declare module olx { interface ImageWMSOptions extends BaseWMSOptions { /** experimental Optional function to load an image given a URL. */ - imageLoadFunction?: any; + imageLoadFunction?: ol.ImageLoadFunctionType; /** Ratio. 1 means image requests are the size of the map viewport, 2 means twice the width and height of the map viewport, and so on. Must be 1 or higher. Default is 1.5. */ ratio?: number; @@ -139,7 +139,7 @@ declare module olx { maxZoom?: number; /** experimental Optional function to load a tile given a URL. */ - tileLoadFunction?: any; //todo + tileLoadFunction?: ol.TileLoadFunctionType; /** WMS service urls. Use this instead of url when the WMS supports multiple urls for GetMap requests. */ urls?: Array; @@ -354,7 +354,7 @@ declare module olx { * a {number} view resolution and an {ol.Coordinate} as arguments, and returns the {number} * resolution at the passed coordinate. */ - getPointResolution?: any; + getPointResolution?: (resolution: number, coordinate: ol.Coordinate) => number; } module animation { @@ -951,6 +951,10 @@ declare module olx { */ declare module ol { + interface TileLoadFunctionType{ (image: ol.Image, url: string): void } + + interface ImageLoadFunctionType{ (image: ol.Image, url: string): void } + /** * An attribution for a layer source. */ From 8d071a6ee3c622f19d7e8fb661e269c18359f2b7 Mon Sep 17 00:00:00 2001 From: Michael Nahkies Date: Thu, 3 Sep 2015 12:00:45 +1200 Subject: [PATCH 034/407] Add definition and test for when.iterate --- when/when-tests.ts | 15 +++++++++++++++ when/when.d.ts | 14 ++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/when/when-tests.ts b/when/when-tests.ts index 6ed82dd32..7cd7e8e45 100644 --- a/when/when-tests.ts +++ b/when/when-tests.ts @@ -101,6 +101,21 @@ when.settle([when(1), when(2), when.reject(new Error("Foo"))]).then(desc return descriptors.filter(d => d.state === 'rejected').reduce((r, d) => r + d.value, 0); }); +/* when.iterate(f, predicate, handler, seed) */ + +when.iterate(function (x) { + return x + 1; +}, function (x) { + // Stop when x >= 100000000000 + return x >= 100000000000; +}, function (x) { + console.log(x); +}, 0).done(function (x) { + console.log(x === 100000000000); +}, function (err) { + console.log(err); +}); + /* when.promise(resolver) */ promise = when.promise(resolve => resolve(5)); diff --git a/when/when.d.ts b/when/when.d.ts index 7ec721390..432a76b36 100644 --- a/when/when.d.ts +++ b/when/when.d.ts @@ -127,6 +127,20 @@ declare module When { */ function settle(promisesOrValues: any[]): Promise[]>; + /** + * Generates a potentially infinite stream of promises by repeatedly calling f until predicate becomes true. + * @memberOf when + * @param f function that, given a seed, returns the next value or a promise for it. + * @param predicate function that receives the current iteration value, and should return truthy when the iterating should stop + * @param handler function that receives each value as it is produced by f. It may return a promise to delay the next iteration. + * @param seed initial value provided to the handler, and first f invocation. May be a promise. + */ + function iterate(f: (seed: U) => U | Promise, + predicate: (value: U) => boolean, + handler: (value: U) => Promise | void, + seed: U | Promise): Promise; + + /** * Creates a {promise, resolver} pair, either or both of which * may be given out safely to consumers. From ed0f1cce4f6669bdbeb3fac8a5104aea084d5057 Mon Sep 17 00:00:00 2001 From: Olivier CHEVET Date: Thu, 3 Sep 2015 06:24:28 +0200 Subject: [PATCH 035/407] Upgraded to chai 3.2.0 (latest) --- chai/chai-2.0.0.d.ts | 308 +++++++++++++++++++++++++++++++++++++++++++ chai/chai-tests.ts | 290 ++++++++++++++++++++++++++++++++++------ chai/chai.d.ts | 94 ++++++++++++- 3 files changed, 643 insertions(+), 49 deletions(-) create mode 100644 chai/chai-2.0.0.d.ts diff --git a/chai/chai-2.0.0.d.ts b/chai/chai-2.0.0.d.ts new file mode 100644 index 000000000..f693582c5 --- /dev/null +++ b/chai/chai-2.0.0.d.ts @@ -0,0 +1,308 @@ +// Type definitions for chai 2.0.0 +// Project: http://chaijs.com/ +// Definitions by: Jed Mao , +// Bart van der Schoor , +// Andrew Brown +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module Chai { + + interface ChaiStatic { + expect: ExpectStatic; + should(): Should; + /** + * Provides a way to extend the internals of Chai + */ + use(fn: (chai: any, utils: any) => void): any; + assert: AssertStatic; + config: Config; + } + + export interface ExpectStatic extends AssertionStatic { + } + + export interface AssertStatic extends Assert { + } + + export interface AssertionStatic { + (target: any, message?: string): Assertion; + } + + interface ShouldAssertion { + equal(value1: any, value2: any, message?: string): void; + Throw: ShouldThrow; + throw: ShouldThrow; + exist(value: any, message?: string): void; + } + + interface Should extends ShouldAssertion { + not: ShouldAssertion; + fail(actual: any, expected: any, message?: string, operator?: string): void; + } + + interface ShouldThrow { + (actual: Function): void; + (actual: Function, expected: string|RegExp, message?: string): void; + (actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void; + } + + interface Assertion extends LanguageChains, NumericComparison, TypeComparison { + not: Assertion; + deep: Deep; + a: TypeComparison; + an: TypeComparison; + include: Include; + contain: Include; + ok: Assertion; + true: Assertion; + false: Assertion; + null: Assertion; + undefined: Assertion; + exist: Assertion; + empty: Assertion; + arguments: Assertion; + Arguments: Assertion; + equal: Equal; + equals: Equal; + eq: Equal; + eql: Equal; + eqls: Equal; + property: Property; + ownProperty: OwnProperty; + haveOwnProperty: OwnProperty; + length: Length; + lengthOf: Length; + match(regexp: RegExp|string, message?: string): Assertion; + string(string: string, message?: string): Assertion; + keys: Keys; + key(string: string): Assertion; + throw: Throw; + throws: Throw; + Throw: Throw; + respondTo(method: string, message?: string): Assertion; + itself: Assertion; + satisfy(matcher: Function, message?: string): Assertion; + closeTo(expected: number, delta: number, message?: string): Assertion; + members: Members; + } + + interface LanguageChains { + to: Assertion; + be: Assertion; + been: Assertion; + is: Assertion; + that: Assertion; + which: Assertion; + and: Assertion; + has: Assertion; + have: Assertion; + with: Assertion; + at: Assertion; + of: Assertion; + same: Assertion; + } + + interface NumericComparison { + above: NumberComparer; + gt: NumberComparer; + greaterThan: NumberComparer; + least: NumberComparer; + gte: NumberComparer; + below: NumberComparer; + lt: NumberComparer; + lessThan: NumberComparer; + most: NumberComparer; + lte: NumberComparer; + within(start: number, finish: number, message?: string): Assertion; + } + + interface NumberComparer { + (value: number, message?: string): Assertion; + } + + interface TypeComparison { + (type: string, message?: string): Assertion; + instanceof: InstanceOf; + instanceOf: InstanceOf; + } + + interface InstanceOf { + (constructor: Object, message?: string): Assertion; + } + + interface Deep { + equal: Equal; + include: Include; + property: Property; + } + + interface Equal { + (value: any, message?: string): Assertion; + } + + interface Property { + (name: string, value?: any, message?: string): Assertion; + } + + interface OwnProperty { + (name: string, message?: string): Assertion; + } + + interface Length extends LanguageChains, NumericComparison { + (length: number, message?: string): Assertion; + } + + interface Include { + (value: Object, message?: string): Assertion; + (value: string, message?: string): Assertion; + (value: number, message?: string): Assertion; + keys: Keys; + members: Members; + } + + interface Keys { + (...keys: string[]): Assertion; + (keys: any[]): Assertion; + } + + interface Throw { + (): Assertion; + (expected: string, message?: string): Assertion; + (expected: RegExp, message?: string): Assertion; + (constructor: Error, expected?: string, message?: string): Assertion; + (constructor: Error, expected?: RegExp, message?: string): Assertion; + (constructor: Function, expected?: string, message?: string): Assertion; + (constructor: Function, expected?: RegExp, message?: string): Assertion; + } + + interface Members { + (set: any[], message?: string): Assertion; + } + + export interface Assert { + /** + * @param expression Expression to test for truthiness. + * @param message Message to display on error. + */ + (expression: any, message?: string): void; + + fail(actual?: any, expected?: any, msg?: string, operator?: string): void; + + ok(val: any, msg?: string): void; + notOk(val: any, msg?: string): void; + + equal(act: any, exp: any, msg?: string): void; + notEqual(act: any, exp: any, msg?: string): void; + + strictEqual(act: any, exp: any, msg?: string): void; + notStrictEqual(act: any, exp: any, msg?: string): void; + + deepEqual(act: any, exp: any, msg?: string): void; + notDeepEqual(act: any, exp: any, msg?: string): void; + + isTrue(val: any, msg?: string): void; + isFalse(val: any, msg?: string): void; + + isNull(val: any, msg?: string): void; + isNotNull(val: any, msg?: string): void; + + isUndefined(val: any, msg?: string): void; + isDefined(val: any, msg?: string): void; + + isFunction(val: any, msg?: string): void; + isNotFunction(val: any, msg?: string): void; + + isObject(val: any, msg?: string): void; + isNotObject(val: any, msg?: string): void; + + isArray(val: any, msg?: string): void; + isNotArray(val: any, msg?: string): void; + + isString(val: any, msg?: string): void; + isNotString(val: any, msg?: string): void; + + isNumber(val: any, msg?: string): void; + isNotNumber(val: any, msg?: string): void; + + isBoolean(val: any, msg?: string): void; + isNotBoolean(val: any, msg?: string): void; + + typeOf(val: any, type: string, msg?: string): void; + notTypeOf(val: any, type: string, msg?: string): void; + + instanceOf(val: any, type: Function, msg?: string): void; + notInstanceOf(val: any, type: Function, msg?: string): void; + + include(exp: string, inc: any, msg?: string): void; + include(exp: any[], inc: any, msg?: string): void; + + notInclude(exp: string, inc: any, msg?: string): void; + notInclude(exp: any[], inc: any, msg?: string): void; + + match(exp: any, re: RegExp, msg?: string): void; + notMatch(exp: any, re: RegExp, msg?: string): void; + + property(obj: Object, prop: string, msg?: string): void; + notProperty(obj: Object, prop: string, msg?: string): void; + deepProperty(obj: Object, prop: string, msg?: string): void; + notDeepProperty(obj: Object, prop: string, msg?: string): void; + + propertyVal(obj: Object, prop: string, val: any, msg?: string): void; + propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; + + deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void; + deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; + + lengthOf(exp: any, len: number, msg?: string): void; + //alias frenzy + throw(fn: Function, msg?: string): void; + throw(fn: Function, regExp: RegExp): void; + throw(fn: Function, errType: Function, msg?: string): void; + throw(fn: Function, errType: Function, regExp: RegExp): void; + + throws(fn: Function, msg?: string): void; + throws(fn: Function, regExp: RegExp): void; + throws(fn: Function, errType: Function, msg?: string): void; + throws(fn: Function, errType: Function, regExp: RegExp): void; + + Throw(fn: Function, msg?: string): void; + Throw(fn: Function, regExp: RegExp): void; + Throw(fn: Function, errType: Function, msg?: string): void; + Throw(fn: Function, errType: Function, regExp: RegExp): void; + + doesNotThrow(fn: Function, msg?: string): void; + doesNotThrow(fn: Function, regExp: RegExp): void; + doesNotThrow(fn: Function, errType: Function, msg?: string): void; + doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void; + + operator(val: any, operator: string, val2: any, msg?: string): void; + closeTo(act: number, exp: number, delta: number, msg?: string): void; + + sameMembers(set1: any[], set2: any[], msg?: string): void; + includeMembers(set1: any[], set2: any[], msg?: string): void; + + ifError(val: any, msg?: string): void; + } + + export interface Config { + includeStack: boolean; + } + + export class AssertionError { + constructor(message: string, _props?: any, ssf?: Function); + name: string; + message: string; + showDiff: boolean; + stack: string; + } +} + +declare var chai: Chai.ChaiStatic; + +declare module "chai" { + export = chai; +} + +interface Object { + should: Chai.Assertion; +} diff --git a/chai/chai-tests.ts b/chai/chai-tests.ts index c34b6cdf1..9b646b152 100644 --- a/chai/chai-tests.ts +++ b/chai/chai-tests.ts @@ -31,6 +31,16 @@ function fail() { err(() => { should.fail('foo', 'bar', 'should fail', 'equal'); }, 'expected fail to throw an AssertionError'); + + err(() => { + expect.fail('foo', 'bar'); + }, 'expected fail to throw an AssertionError'); + err(() => { + expect.fail('foo', 'bar', 'should fail'); + }, 'expected fail to throw an AssertionError'); + err(() => { + expect.fail('foo', 'bar', 'should fail', 'equal'); + }, 'expected fail to throw an AssertionError'); } // ReSharper disable once InconsistentNaming @@ -107,11 +117,20 @@ function _undefined() { }, 'expected \'\' to be undefined'); } +function _NaN() { + expect(NaN).to.be.NaN; + expect(12).to.be.not.NaN; + expect("NaN").to.be.not.NaN; + (NaN).should.be.NaN; + (12).should.be.not.NaN; + ("NaN").should.be.not.NaN; +} + function exist() { var foo = 'bar'; expect(foo).to.exist; should.exist(foo); - expect(void(0)).to.not.exist; + expect(void (0)).to.not.exist; should.not.exist(void (0)); } @@ -128,8 +147,8 @@ function argumentsTest() { } function equal() { - expect(undefined).to.equal(void(0)); - should.equal(undefined, void(0)); + expect(undefined).to.equal(void (0)); + should.equal(undefined, void (0)); } function _typeof() { @@ -372,6 +391,9 @@ function match() { expect('foobar').to.not.match(/^bar/); 'foobar'.should.not.match(/^bar/); + expect('foobar').matches(/^foo/); + 'foobar'.should.not.matches(/^bar/); + err(() => { expect('foobar').to.match(/^bar/i, 'blah'); 'foobar'.should.match(/^bar/i, 'blah'); @@ -490,8 +512,8 @@ function deepEqual3() { function deepInclude() { expect(['foo', 'bar']).to.deep.include(['bar', 'foo']); ['foo', 'bar'].should.deep.include(['bar', 'foo']); - expect(['foo', 'bar']).not.to.deep.equal(['foo', 'baz' ]); - ['foo', 'bar'].should.not.deep.equal(['foo', 'baz' ]); + expect(['foo', 'bar']).not.to.deep.equal(['foo', 'baz']); + ['foo', 'bar'].should.not.deep.equal(['foo', 'baz']); } class FakeArgs { @@ -670,6 +692,20 @@ function ownProperty() { }, 'blah: expected { length: 12 } to not have own property \'length\''); } +function ownPropertyDescriptor() { + expect('test').to.have.ownPropertyDescriptor('length'); + expect('test').to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 }); + expect('test').not.to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 }); + expect('test').to.haveOwnPropertyDescriptor('length').to.have.property('enumerable', false); + expect('test').to.haveOwnPropertyDescriptor('length').to.contain.keys('value'); + + 'test'.should.have.ownPropertyDescriptor('length'); + 'test'.should.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 }); + 'test'.should.not.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 }); + 'test'.should.haveOwnPropertyDescriptor('length').to.have.property('enumerable', false); + 'test'.should.haveOwnPropertyDescriptor('length').to.contain.keys('value'); +} + function string() { expect('foobar').to.have.string('bar'); 'foobar'.should.have.string('bar'); @@ -707,6 +743,10 @@ function include() { ['foo', 'bar'].should.not.include('baz'); expect(['foo', 'bar']).to.not.include(1); ['foo', 'bar'].should.not.include(1); + // alias + + expect(['foo', 'bar']).includes('foo'); + ['foo', 'bar'].should.includes('foo'); err(() => { expect(['foo']).to.include('bar', 'blah'); @@ -732,6 +772,14 @@ function keys() { ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('bar', 'foo'); expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('baz'); ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('baz'); + // alias + + expect({ foo: 1, bar: 2, baz: 3 }).contains.keys('baz'); + + expect({ foo: 1, bar: 2 }).to.have.all.keys(['foo', 'bar']); + expect({ foo: 1, bar: 2 }).to.have.any.keys(['foo', 'bar']); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.all.keys('baz'); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.any.keys('baz'); expect({ foo: 1, bar: 2 }).to.contain.keys('foo'); ({ foo: 1, bar: 2 }).should.contain.keys('foo'); @@ -830,7 +878,28 @@ function chaining() { tea.should.be.a('object').and.have.property('name', 'chai'); } -class PoorlyConstructedError {} +function exxtensible() { + expect({}).to.be.extensible; + expect(Object.preventExtensions({})).to.be.not.extensible; + ({}).should.be.extensible; + Object.preventExtensions({}).should.not.be.extensible; +} +function sealed() { + expect({}).to.be.not.sealed; + expect(Object.seal({})).to.be.sealed; + ({}).should.be.not.sealed; + Object.seal({}).should.be.sealed; +} + +function frozen() { + expect({}).to.be.not.frozen; + expect(Object.freeze({})).to.be.frozen; + ({}).should.be.not.frozen; + Object.freeze({}).should.be.frozen; +} + + +class PoorlyConstructedError { } function _throw() { // See GH-45: some poorly-constructed custom errors don't have useful names // on either their constructor or their constructor prototype, but instead @@ -1023,34 +1092,44 @@ function _throw() { }, 'blah: expected [Function] to throw error including \'hello\' but got \'testing\''); } -function use(){ +function use() { // ReSharper disable once InconsistentNaming chai.use((_chai) => { - _chai.can.use.any(); + _chai.can.use.any(); }); } +class Klass { + val: number; + constructor() { this.val = 0; } + bar() { } + + static baz() { } +} + function respondTo() { - var bar = {}; + var obj = new Klass(); - expect(Foo).to.respondTo('bar'); - Foo.should.respondTo('bar'); - expect(Foo).to.not.respondTo('foo'); - Foo.should.not.respondTo('foo'); - expect(Foo).itself.to.respondTo('func'); - expect(Foo).itself.not.to.respondTo('bar'); + expect(Klass).to.respondTo('bar'); + expect(obj).respondsTo('bar'); + Klass.should.respondTo('bar'); + Klass.should.respondsTo('bar'); + expect(Klass).to.not.respondTo('foo'); + Klass.should.not.respondTo('foo'); + expect(Klass).itself.to.respondTo('func'); + expect(Klass).itself.not.to.respondTo('bar'); - expect(bar).to.respondTo('foo'); - bar.should.respondTo('foo'); + expect(obj).not.to.respondTo('foo'); + obj.should.not.respondTo('foo'); err(() => { - expect(Foo).to.respondTo('baz', 'constructor'); - Foo.should.respondTo('baz', 'constructor'); - }, /^(constructor: expected)(.*)(\[Function: Foo\])(.*)(to respond to \'baz\')$/); + expect(Klass).to.respondTo('baz', 'constructor'); + Klass.should.respondTo('baz', 'constructor'); + }, /^(constructor: expected)(.*)(\[Function: Klass\])(.*)(to respond to \'baz\')$/); err(() => { - expect(bar).to.respondTo('baz', 'object'); - bar.should.respondTo('baz', 'object'); + expect(obj).to.respondTo('baz', 'object'); + obj.should.respondTo('baz', 'object'); }, /^(object: expected)(.*)(\{ foo: \[Function\] \}|\{ Object \()(.*)(to respond to \'baz\')$/); } @@ -1116,6 +1195,23 @@ function sameMembers() { [5, 4].should.not.have.same.members([6, 3]); expect([5, 4]).to.not.have.same.members([5, 4, 2]); [5, 4].should.not.have.same.members([5, 4, 2]); + + assert.sameMembers([5, 4], [4, 5]); +} +function sameDeepMembers() { + expect([{ id: 5 }, { id: 4 }]).to.have.same.deep.members([{ id: 4 }, { id: 5 }]); + [{ id: 5 }, { id: 4 }].should.have.same.deep.members([{ id: 4 }, { id: 5 }]); + expect([{ id: 5 }, { id: 4 }]).to.have.same.members([{ id: 5 }, { id: 4 }]); + [{ id: 5 }, { id: 4 }].should.have.same.members([{ id: 5 }, { id: 4 }]); + + expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([]); + [{ id: 5 }, { id: 4 }].should.not.have.same.members([]); + expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([{ id: 6 }, { id: 3 }]); + [{ id: 5 }, { id: 4 }].should.not.have.same.members([{ id: 6 }, { id: 3 }]); + expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([{ id: 5 }, { id: 4 }, { id: 2 }]); + [{ id: 5 }, { id: 4 }].should.not.have.same.members([{ id: 5 }, { id: 4 }, { id: 2 }]); + + assert.sameDeepMembers([{ id: 5 }, { id: 4 }], [{ id: 4 }, { id: 5 }]); } function members() { @@ -1127,16 +1223,48 @@ function members() { expect([5, 4]).not.members([5, 4, 2]); } +function increaseDecreaseChange() { + var obj = { val: 10 }; + var inc = () => { obj.val++; }; + var dec = () => { obj.val--; }; + var same = () => { }; + + expect(inc).to.increase(obj, "val"); + expect(inc).increases(obj, "val"); + expect(inc).to.change(obj, "val"); + + expect(dec).to.decrease(obj, "val"); + expect(dec).decreases(obj, "val"); + expect(dec).to.change(obj, "val"); + expect(dec).changes(obj, "val"); + + expect(inc).to.not.decrease(obj, "val"); + expect(dec).to.not.increase(obj, "val"); + expect(same).to.not.increase(obj, "val"); + expect(same).to.not.decrease(obj, "val"); + expect(same).to.not.change(obj, "val"); + + inc.should.increase(obj, "val"); + inc.should.change(obj, "val"); + + dec.should.decrease(obj, "val"); + dec.should.change(obj, "val"); + + inc.should.not.decrease(obj, "val"); + dec.should.not.increase(obj, "val"); + same.should.not.change(obj, "val"); +} + //tdd -declare function suite(description: string, action: Function):void; -declare function test(description: string, action: Function):void; +declare function suite(description: string, action: Function): void; +declare function test(description: string, action: Function): void; interface FieldObj { field: any; } class CrashyObject { - inspect (): void { + inspect(): void { throw new Error('Arg\'s inspect() called even though the test passed'); } } @@ -1172,6 +1300,9 @@ suite('assert', () => { assert.ok(true); assert.ok(1); assert.ok('test'); + assert.isOk(true); + assert.isOk(1); + assert.isOk('test'); err(() => { assert.ok(false); @@ -1186,6 +1317,27 @@ suite('assert', () => { }, 'expected \'\' to be truthy'); }); + test('notOk', () => { + assert.notOk(false); + assert.notOk(0); + assert.notOk(''); + assert.isNotOk(false); + assert.isNotOk(0); + assert.isNotOk(''); + + err(() => { + assert.notOk(true); + }, 'expected true to be falsy'); + + err(() => { + assert.notOk(1); + }, 'expected 1 to be falsy'); + + err(() => { + assert.notOk('test'); + }, 'expected \'test\' to be falsy'); + }); + test('isFalse', () => { assert.isFalse(false); @@ -1199,7 +1351,7 @@ suite('assert', () => { }); test('equal', () => { - assert.equal(void(0), undefined); + assert.equal(void (0), undefined); }); test('typeof / notTypeOf', () => { @@ -1288,19 +1440,19 @@ suite('assert', () => { }); test('deepEqual', () => { - assert.deepEqual({tea: 'chai'}, {tea: 'chai'}); + assert.deepEqual({ tea: 'chai' }, { tea: 'chai' }); err(() => { - assert.deepEqual({tea: 'chai'}, {tea: 'black'}); + assert.deepEqual({ tea: 'chai' }, { tea: 'black' }); }, 'expected { tea: \'chai\' } to deeply equal { tea: \'black\' }'); var obja = Object.create({ tea: 'chai' }) - , objb = Object.create({ tea: 'chai' }); + , objb = Object.create({ tea: 'chai' }); assert.deepEqual(obja, objb); - var obj1 = Object.create({tea: 'chai'}) - , obj2 = Object.create({tea: 'black'}); + var obj1 = Object.create({ tea: 'chai' }) + , obj2 = Object.create({ tea: 'black' }); err(() => { assert.deepEqual(obj1, obj2); @@ -1309,13 +1461,13 @@ suite('assert', () => { test('deepEqual (ordering)', () => { var a = { a: 'b', c: 'd' } - , b = { c: 'd', a: 'b' }; + , b = { c: 'd', a: 'b' }; assert.deepEqual(a, b); }); test('deepEqual (circular)', () => { - var circularObject:any = {} - , secondCircularObject:any = {}; + var circularObject: any = {} + , secondCircularObject: any = {}; circularObject.field = circularObject; secondCircularObject.field = secondCircularObject; @@ -1328,15 +1480,15 @@ suite('assert', () => { }); test('notDeepEqual', () => { - assert.notDeepEqual({tea: 'jasmine'}, {tea: 'chai'}); + assert.notDeepEqual({ tea: 'jasmine' }, { tea: 'chai' }); err(() => { - assert.notDeepEqual({tea: 'chai'}, {tea: 'chai'}); + assert.notDeepEqual({ tea: 'chai' }, { tea: 'chai' }); }, 'expected { tea: \'chai\' } to not deeply equal { tea: \'chai\' }'); }); test('notDeepEqual (circular)', () => { - var circularObject:any = {} - , secondCircularObject:any = { tea: 'jasmine' }; + var circularObject: any = {} + , secondCircularObject: any = { tea: 'jasmine' }; circularObject.field = circularObject; secondCircularObject.field = secondCircularObject; @@ -1380,6 +1532,22 @@ suite('assert', () => { }, 'expected undefined to not equal undefined'); }); + test('isNaN', () => { + assert.isNaN(NaN); + + err(() => { + assert.isNaN(12); + }, 'expected 12 to be NaN'); + }); + + test('isNotNaN', () => { + assert.isNotNaN(12); + + err(() => { + assert.isNotNaN(NaN); + }, 'expected NaN to not NaN'); + }); + test('isFunction', () => { var func = () => { }; @@ -1431,7 +1599,7 @@ suite('assert', () => { test('isNotString', () => { assert.isNotString(3); - assert.isNotString([ 'hello' ]); + assert.isNotString(['hello']); err(() => { assert.isNotString('hello'); @@ -1449,7 +1617,7 @@ suite('assert', () => { test('isNotNumber', () => { assert.isNotNumber('hello'); - assert.isNotNumber([ 5 ]); + assert.isNotNumber([5]); err(() => { assert.isNotNumber(4); @@ -1479,7 +1647,7 @@ suite('assert', () => { test('include', () => { assert.include('foobar', 'bar'); - assert.include([ 1, 2, 3], 3); + assert.include([1, 2, 3], 3); err(() => { assert.include('foobar', 'baz'); @@ -1492,7 +1660,7 @@ suite('assert', () => { test('notInclude', () => { assert.notInclude('foobar', 'baz'); - assert.notInclude([ 1, 2, 3 ], 4); + assert.notInclude([1, 2, 3], 4); err(() => { assert.notInclude('foobar', 'bar'); @@ -1739,4 +1907,42 @@ suite('assert', () => { }, 'expected [ 1, 54 ] to have the same members as [ 6, 1, 54 ]'); }); + + test('isAbove', () => { + assert.isAbove(10, 5); + + err(() => { + assert.isAbove(1, 5); + }, 'expected 1 to be above 5'); + err(() => { + assert.isAbove(5, 5); + }, 'expected 5 to be above 5'); + }); + + test('isBelow', () => { + assert.isBelow(5, 10); + + err(() => { + assert.isBelow(5, 1); + }, 'expected 5 to be above 1'); + err(() => { + assert.isBelow(5, 5); + }, 'expected 5 to be below 5'); + }); + + test('extensible', () => { assert.extensible({}); }); + test('isExtensible', () => { assert.isExtensible({}); }); + test('notExtensible', () => { assert.notExtensible(Object.preventExtensions({})); }); + test('isNotExtensible', () => { assert.isNotExtensible(Object.preventExtensions({})); }); + + test('sealed', () => { assert.sealed(Object.seal({})); }); + test('isSealed', () => { assert.isSealed(Object.seal({})); }); + test('notSealed', () => { assert.notSealed({}); }); + test('isNotSealed', () => { assert.isNotSealed({}); }); + + test('frozen', () => { assert.frozen(Object.freeze({})); }); + test('isFrozen', () => { assert.isFrozen(Object.freeze({})); }); + test('notFrozen', () => { assert.notFrozen({}); }); + test('isNotFrozen', () => { assert.isNotFrozen({}); }); + }); diff --git a/chai/chai.d.ts b/chai/chai.d.ts index f693582c5..da4d718e1 100644 --- a/chai/chai.d.ts +++ b/chai/chai.d.ts @@ -1,10 +1,13 @@ -// Type definitions for chai 2.0.0 +// Type definitions for chai 3.2.0 // Project: http://chaijs.com/ // Definitions by: Jed Mao , // Bart van der Schoor , -// Andrew Brown +// Andrew Brown , +// Olivier Chevet // Definitions: https://github.com/borisyankov/DefinitelyTyped +// + declare module Chai { interface ChaiStatic { @@ -16,9 +19,11 @@ declare module Chai { use(fn: (chai: any, utils: any) => void): any; assert: AssertStatic; config: Config; + AssertionError: AssertionError; } export interface ExpectStatic extends AssertionStatic { + fail(actual?: any, expected?: any, message?: string, operator?: string): void; } export interface AssertStatic extends Assert { @@ -49,15 +54,20 @@ declare module Chai { interface Assertion extends LanguageChains, NumericComparison, TypeComparison { not: Assertion; deep: Deep; + any: KeyFilter; + all: KeyFilter; a: TypeComparison; an: TypeComparison; include: Include; + includes: Include; contain: Include; + contains: Include; ok: Assertion; true: Assertion; false: Assertion; null: Assertion; undefined: Assertion; + NaN: Assertion; exist: Assertion; empty: Assertion; arguments: Assertion; @@ -70,20 +80,35 @@ declare module Chai { property: Property; ownProperty: OwnProperty; haveOwnProperty: OwnProperty; + ownPropertyDescriptor: OwnPropertyDescriptor; + haveOwnPropertyDescriptor: OwnPropertyDescriptor; length: Length; lengthOf: Length; - match(regexp: RegExp|string, message?: string): Assertion; + match: Match; + matches: Match; string(string: string, message?: string): Assertion; keys: Keys; key(string: string): Assertion; throw: Throw; throws: Throw; Throw: Throw; - respondTo(method: string, message?: string): Assertion; + respondTo: RespondTo; + respondsTo: RespondTo; itself: Assertion; - satisfy(matcher: Function, message?: string): Assertion; + satisfy: Satisfy; + satisfies: Satisfy; closeTo(expected: number, delta: number, message?: string): Assertion; members: Members; + increase: PropertyChange; + increases: PropertyChange; + decrease: PropertyChange; + decreases: PropertyChange; + change: PropertyChange; + changes: PropertyChange; + extensible: Assertion; + sealed: Assertion; + frozen: Assertion; + } interface LanguageChains { @@ -134,6 +159,11 @@ declare module Chai { equal: Equal; include: Include; property: Property; + members: Members; + } + + interface KeyFilter { + keys: Keys; } interface Equal { @@ -148,6 +178,11 @@ declare module Chai { (name: string, message?: string): Assertion; } + interface OwnPropertyDescriptor { + (name: string, descriptor: PropertyDescriptor, message?: string): Assertion; + (name: string, message?: string): Assertion; + } + interface Length extends LanguageChains, NumericComparison { (length: number, message?: string): Assertion; } @@ -158,11 +193,18 @@ declare module Chai { (value: number, message?: string): Assertion; keys: Keys; members: Members; + any: KeyFilter; + all: KeyFilter; + } + + interface Match { + (regexp: RegExp|string, message?: string): Assertion; } interface Keys { (...keys: string[]): Assertion; (keys: any[]): Assertion; + (keys: Object): Assertion; } interface Throw { @@ -175,10 +217,22 @@ declare module Chai { (constructor: Function, expected?: RegExp, message?: string): Assertion; } + interface RespondTo { + (method: string, message?: string): Assertion; + } + + interface Satisfy { + (matcher: Function, message?: string): Assertion; + } + interface Members { (set: any[], message?: string): Assertion; } + interface PropertyChange { + (object: Object, prop: string, msg?: string): Assertion; + } + export interface Assert { /** * @param expression Expression to test for truthiness. @@ -189,7 +243,9 @@ declare module Chai { fail(actual?: any, expected?: any, msg?: string, operator?: string): void; ok(val: any, msg?: string): void; + isOk(val: any, msg?: string): void; notOk(val: any, msg?: string): void; + isNotOk(val: any, msg?: string): void; equal(act: any, exp: any, msg?: string): void; notEqual(act: any, exp: any, msg?: string): void; @@ -209,6 +265,12 @@ declare module Chai { isUndefined(val: any, msg?: string): void; isDefined(val: any, msg?: string): void; + isNaN(val: any, msg?: string): void; + isNotNaN(val: any, msg?: string): void; + + isAbove(val: number, abv: number, msg?: string): void; + isBelow(val: number, blw: number, msg?: string): void; + isFunction(val: any, msg?: string): void; isNotFunction(val: any, msg?: string): void; @@ -279,9 +341,27 @@ declare module Chai { closeTo(act: number, exp: number, delta: number, msg?: string): void; sameMembers(set1: any[], set2: any[], msg?: string): void; - includeMembers(set1: any[], set2: any[], msg?: string): void; + sameDeepMembers(set1: any[], set2: any[], msg?: string): void; + includeMembers(superset: any[], subset: any[], msg?: string): void; ifError(val: any, msg?: string): void; + + isExtensible(obj: {}, msg?: string): void; + extensible(obj: {}, msg?: string): void; + isNotExtensible(obj: {}, msg?: string): void; + notExtensible(obj: {}, msg?: string): void; + + isSealed(obj: {}, msg?: string): void; + sealed(obj: {}, msg?: string): void; + isNotSealed(obj: {}, msg?: string): void; + notSealed(obj: {}, msg?: string): void; + + isFrozen(obj: Object, msg?: string): void; + frozen(obj: Object, msg?: string): void; + isNotFrozen(obj: Object, msg?: string): void; + notFrozen(obj: Object, msg?: string): void; + + } export interface Config { @@ -305,4 +385,4 @@ declare module "chai" { interface Object { should: Chai.Assertion; -} +} From b366162ae8eb6db0758e6a923e11a7104775461e Mon Sep 17 00:00:00 2001 From: Paul Jolly Date: Wed, 2 Sep 2015 18:34:14 +0100 Subject: [PATCH 036/407] Add definition of Slider constructor --- bootstrap-slider/bootstrap-slider.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bootstrap-slider/bootstrap-slider.d.ts b/bootstrap-slider/bootstrap-slider.d.ts index 78aeb645c..d66c85ab1 100644 --- a/bootstrap-slider/bootstrap-slider.d.ts +++ b/bootstrap-slider/bootstrap-slider.d.ts @@ -137,6 +137,13 @@ interface JQueryEventObject { value: number|ChangeValue; } +interface SliderStatics { + new (selector: string, opts: SliderOptions): Slider; + prototype: Slider; +} + +declare var Slider: SliderStatics; + /** * This class is actually not used when using the jQuery version of bootstrap-slider * The method documentation is still here thouh. From 3cb092884b27264e900c4d0e94c3d8e74cfc548d Mon Sep 17 00:00:00 2001 From: wanwan31 Date: Thu, 3 Sep 2015 10:27:46 +0200 Subject: [PATCH 037/407] fix comma Im getting this error with gulp: highcharts-ng/higcharts-ng-d.ts(27,6) : error TS1005: ';' expected. --- highcharts-ng/highcharts-ng.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/highcharts-ng/highcharts-ng.d.ts b/highcharts-ng/highcharts-ng.d.ts index d0a340559..ea7caa883 100644 --- a/highcharts-ng/highcharts-ng.d.ts +++ b/highcharts-ng/highcharts-ng.d.ts @@ -24,7 +24,7 @@ interface HighChartsNGConfig { currentMin?: number; currentMax?: number; title?: { text?: string } - }, + }; //Whether to use HighStocks instead of HighCharts (optional). Defaults to false. useHighStocks?: boolean; //size (optional) if left out the chart will default to size of the div or something sensible. @@ -40,4 +40,4 @@ interface HighChartsNGConfig { interface HighChartsNGChart extends HighChartsNGConfig { //This is a simple way to access all the Highcharts API that is not currently managed by this directive. getHighcharts(): HighchartsChartObject; -} \ No newline at end of file +} From f91384300695af40e9764ad907bcd24ea743cd91 Mon Sep 17 00:00:00 2001 From: Alain Sahli Date: Thu, 3 Sep 2015 10:54:06 +0200 Subject: [PATCH 038/407] add support for AMD require --- angular-ui-bootstrap/angular-ui-bootstrap.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts index 1a36d21a2..8ebfdb6c2 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts @@ -5,6 +5,9 @@ /// +// Support for AMD require +declare module 'angular-bootstrap' {} + declare module angular.ui.bootstrap { interface IAccordionConfig { From 1a61d12d8d63514e1f1d3fcedf44b2384780c302 Mon Sep 17 00:00:00 2001 From: "Ciuca, Alexandru" Date: Thu, 3 Sep 2015 15:56:47 +0300 Subject: [PATCH 039/407] angular.d.ts - type safety for $controller --- angularjs/angular.d.ts | 5 +++-- bardjs/bardjs-tests.ts | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index d183167b5..dc7f5dae8 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1230,8 +1230,9 @@ declare module angular { /////////////////////////////////////////////////////////////////////////// interface IControllerService { // Although the documentation doesn't state this, locals are optional - (controllerConstructor: Function, locals?: any, bindToController?: any): any; - (controllerName: string, locals?: any, bindToController?: any): any; + (controllerConstructor: new (...args: any[]) => T, locals?: any, bindToController?: any): T; + (controllerConstructor: Function, locals?: any, bindToController?: any): T; + (controllerName: string, locals?: any, bindToController?: any): T; } interface IControllerProvider extends IServiceProvider { diff --git a/bardjs/bardjs-tests.ts b/bardjs/bardjs-tests.ts index 71671b23e..312b06496 100644 --- a/bardjs/bardjs-tests.ts +++ b/bardjs/bardjs-tests.ts @@ -232,7 +232,7 @@ module bardTests { _default: $q.when([]) }); - controller = $controller('MyController'); + controller = $controller('MyController'); $rootScope.$apply(); }); } @@ -264,7 +264,7 @@ module bardTests { _default: $q.when([]) }); - controller = $controller('MyController'); + controller = $controller('MyController'); $rootScope.$apply(); }); From e9bb5d7b8240732dcaca4ecf208a313d6794a27e Mon Sep 17 00:00:00 2001 From: psnider Date: Thu, 3 Sep 2015 13:51:49 +0000 Subject: [PATCH 040/407] updated to fully match 1.2.5 wrapped interfaces in a module, removed prefixes --- tv4/{tv4-tests.ts => tv4-1.2.4-tests.ts} | 0 tv4/tv4-1.2.4.d.ts | 48 ++++++++ tv4/tv4.d.ts | 134 ++++++++++++++++------- 3 files changed, 143 insertions(+), 39 deletions(-) rename tv4/{tv4-tests.ts => tv4-1.2.4-tests.ts} (100%) create mode 100644 tv4/tv4-1.2.4.d.ts diff --git a/tv4/tv4-tests.ts b/tv4/tv4-1.2.4-tests.ts similarity index 100% rename from tv4/tv4-tests.ts rename to tv4/tv4-1.2.4-tests.ts diff --git a/tv4/tv4-1.2.4.d.ts b/tv4/tv4-1.2.4.d.ts new file mode 100644 index 000000000..02b7ebba2 --- /dev/null +++ b/tv4/tv4-1.2.4.d.ts @@ -0,0 +1,48 @@ +// Type definitions for Tiny Validator tv4 1.0.6 +// Project: https://github.com/geraintluff/tv4 +// Definitions by: Bart van der Schoor +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface TV4ErrorCodes { + [key:string]:number; +} +interface TV4Error { + code:number; + message:string; + dataPath:string; + schemaPath:string; +} +interface TV4SchemaMap { + [uri:string]:any; +} +interface TV4BaseResult { + missing:string[]; + valid:boolean; +} +interface TV4SingleResult extends TV4BaseResult { + error:TV4Error; +} +interface TV4MultiResult extends TV4BaseResult { + errors:TV4Error[]; +} +interface TV4 { + validateResult(data:any, schema:any):TV4SingleResult; + validateMultiple(data:any, schema:any):TV4MultiResult; + + addSchema(uri:string, schema:any):boolean; + getSchema(uri:string):any; + normSchema(schema:any, baseUri:string):any; + resolveUrl(base:string, href:string):string; + freshApi():TV4; + dropSchemas():void; + reset():void; + + getMissingUris(exp?:RegExp):string[]; + getSchemaUris(exp?:RegExp):string[]; + getSchemaMap():TV4SchemaMap; + errorCodes:TV4ErrorCodes; +} +declare module "tv4" { + var tv4: TV4 + export = tv4; +} diff --git a/tv4/tv4.d.ts b/tv4/tv4.d.ts index 02b7ebba2..3ee5a2aed 100644 --- a/tv4/tv4.d.ts +++ b/tv4/tv4.d.ts @@ -1,48 +1,104 @@ -// Type definitions for Tiny Validator tv4 1.0.6 +// Type definitions for Tiny Validator tv4 1.2.5 // Project: https://github.com/geraintluff/tv4 // Definitions by: Bart van der Schoor +// Definitions by: Peter Snider // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface TV4ErrorCodes { - [key:string]:number; -} -interface TV4Error { - code:number; - message:string; - dataPath:string; - schemaPath:string; -} -interface TV4SchemaMap { - [uri:string]:any; -} -interface TV4BaseResult { - missing:string[]; - valid:boolean; -} -interface TV4SingleResult extends TV4BaseResult { - error:TV4Error; -} -interface TV4MultiResult extends TV4BaseResult { - errors:TV4Error[]; -} -interface TV4 { - validateResult(data:any, schema:any):TV4SingleResult; - validateMultiple(data:any, schema:any):TV4MultiResult; +declare module tv4 { + + // Note that every top-level property is optional in json-schema + export interface JsonSchema { + [key: string]: any; + title?: string; // used for humans only, and not used for computation + description?: string; // used for humans only, and not used for computation + id?: string; + $schema?: string; + type?: string; + items?: any; + properties?: any; + patternProperties?: any; + additionalProperties?: boolean; + required?: string[]; + definitions?: any; + default?: any; + } - addSchema(uri:string, schema:any):boolean; - getSchema(uri:string):any; - normSchema(schema:any, baseUri:string):any; - resolveUrl(base:string, href:string):string; - freshApi():TV4; - dropSchemas():void; - reset():void; + export type SchemaMap = {[uri: string]: JsonSchema;}; + // maps error codes/names to human readable error description for a single language + export type ErrorMap = {[errorCode: string]: string;}; - getMissingUris(exp?:RegExp):string[]; - getSchemaUris(exp?:RegExp):string[]; - getSchemaMap():TV4SchemaMap; - errorCodes:TV4ErrorCodes; + + export interface ErrorCodes { + [key:string]:number; + } + export interface ValidationError { + code:number; + message:any; + dataPath?:string; + schemaPath?:string; + subErrors?: ValidationError[]; + } + export interface ErrorVar extends ValidationError { + params: any; + subErrors: any; + stack: string; + } + export interface BaseResult { + missing:string[]; + valid:boolean; + } + export interface SingleResult extends BaseResult { + error:ValidationError; + } + export interface MultiResult extends BaseResult { + errors:ValidationError[]; + } + export type FormatValidationFunction = (data: any, schema: JsonSchema) => string; + // documentation doesnt agree with code in tv4, this type agrees with code + export type KeywordValidationFunction = (data: any, value: any, schema: JsonSchema, dataPointerPath: string) => string | ValidationError; + export type AsyncValidationCallback = (isValid: boolean, error: ValidationError) => void; + export interface TV4 { + error: ErrorVar; + missing: string[]; + // primary API + validate(data: any, schema: JsonSchema, checkRecursive?: boolean): boolean; + validate(data: any, schema: JsonSchema, checkRecursive: boolean, banUnknownProperties: boolean): boolean; + validateResult(data: any, schema: JsonSchema, checkRecursive?: boolean): SingleResult; + validateResult(data: any, schema: JsonSchema, checkRecursive: boolean, banUnknownProperties: boolean): SingleResult; + validateMultiple(data: any, schema: JsonSchema, checkRecursive?: boolean): MultiResult; + validateMultiple(data: any, schema: JsonSchema, checkRecursive: boolean, banUnknownProperties: boolean): MultiResult; + // from including: tv4.async-jquery.js + validate(data: any, schema: JsonSchema, callback: AsyncValidationCallback, checkRecursive?: boolean): void; + validate(data: any, schema: JsonSchema, callback: AsyncValidationCallback, checkRecursive: boolean, banUnknownProperties: boolean): void; + + // additional API for more complex cases + addSchema(schema: JsonSchema): void; + addSchema(uri:string, schema: JsonSchema): void; + getSchema(uri:string): JsonSchema; + getSchemaMap(): SchemaMap; + getSchemaUris(filter?: RegExp): string[]; + getMissingUris(filter?: RegExp): string[]; + dropSchemas(): void; + freshApi(): TV4; + reset(): void; + setErrorReporter(lang: string): void; + setErrorReporter(reporter: (error: ValidationError, data: any, schema: JsonSchema) => string): void; + language(code: string): void; + addLanguage(code: string, map: ErrorMap): void; + addFormat(format: string, validationFunction: FormatValidationFunction): void; + addFormat(formats: {[formatName: string]: FormatValidationFunction;}): void; + defineKeyword(keyword: string, validationFunction: KeywordValidationFunction): void; + defineError(codeName: string, codeNumber: number, defaultMessage: string): void; + + // not documented + normSchema(schema: JsonSchema, baseUri:string):any; + resolveUrl(base:string, href:string):string; + + errorCodes:ErrorCodes; + } } + declare module "tv4" { - var tv4: TV4 - export = tv4; + var out: tv4.TV4 + export = out; } From 39126634d14770c9738ceeabaefcc09f178d6817 Mon Sep 17 00:00:00 2001 From: psnider Date: Thu, 3 Sep 2015 13:56:51 +0000 Subject: [PATCH 041/407] updated ref in older 1.2.4 test --- tv4/tv4-1.2.4-tests.ts | 2 +- tv4/tv4-tests.ts | 174 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 tv4/tv4-tests.ts diff --git a/tv4/tv4-1.2.4-tests.ts b/tv4/tv4-1.2.4-tests.ts index 2768d9f5f..d899be50f 100644 --- a/tv4/tv4-1.2.4-tests.ts +++ b/tv4/tv4-1.2.4-tests.ts @@ -1,4 +1,4 @@ -/// +/// var str:string; var strArr:string[]; diff --git a/tv4/tv4-tests.ts b/tv4/tv4-tests.ts new file mode 100644 index 000000000..84a4ee328 --- /dev/null +++ b/tv4/tv4-tests.ts @@ -0,0 +1,174 @@ +/// + +var str:string; +var strArr:string[]; +var bool:boolean; +var num:number; +var obj:any; +var validator: tv4.TV4; +var err:tv4.ValidationError; +var errs:tv4.ValidationError[]; +var single:tv4.SingleResult; +var multi:tv4.MultiResult; + +single = validator.validateResult(obj, obj); +bool = single.valid; +strArr = single.missing; +err = single.error; + +num = err.code; +str = err.message; +str = err.dataPath; +str = err.schemaPath; + +multi = validator.validateMultiple(obj, obj); +bool = multi.valid; +strArr = multi.missing; +errs = multi.errors; + +validator.addSchema(str, obj); +obj = validator.getSchema(str); +str = validator.resolveUrl(str, str); + +validator = validator.freshApi(); +validator.dropSchemas(); +validator.reset(); + +strArr = validator.getMissingUris(/abc/); +strArr = validator.getSchemaUris(/abc/); +obj = validator.getSchemaMap()[str]; +num = validator.errorCodes['bla']; + +num = validator.errorCodes['MY_NAME']; + + +// Here are all the examples from the v1.2.3 documentation at https://www.npmjs.com/package/validator +var data = ''; +var schema : tv4.JsonSchema = {type: "string"} +var valid = validator.validate(data, schema); +var url = 'http://example.com/schema'; +validator.addSchema(url, schema); +var singleErrorResult = validator.validateResult(data, schema); +var multiErrorResult = validator.validateMultiple(data, schema); +// async +validator.validate(data, schema, function (isValid, validationError) {}); + +// checkRecursive +var a : tv4.JsonSchema = {}; +var b = { a: a }; +a['b'] = b; +var aSchema : tv4.JsonSchema = { properties: { b: { $ref: 'bSchema' }}}; +var bSchema : tv4.JsonSchema = { properties: { a: { $ref: 'aSchema' }}}; +validator.addSchema('aSchema', aSchema); +validator.addSchema('bSchema', bSchema); +validator.validate(a, aSchema, true); +validator.validateResult(data, aSchema, true); +validator.validateMultiple(data, aSchema, true); + + +// banUnknownProperties +var checkRecursive = true; +validator.validate(data, schema, checkRecursive, true); +validator.validateResult(data, schema, checkRecursive, true); +validator.validateMultiple(data, schema, checkRecursive, true); + +// API +validator.addSchema('http://example.com/schema', {}); +validator.addSchema({}); +var schema = validator.getSchema('http://example.com/schema'); +var map = validator.getSchemaMap(); +var schema = map[uri]; +var arr = validator.getSchemaUris(); +// optional filter using a RegExp +arr = validator.getSchemaUris(/^https?:\/\/example.com/); +var arr = validator.getMissingUris(); +// optional filter using a RegExp +var arr = validator.getMissingUris(/^https?:\/\/example.com/); +validator.dropSchemas(); +var other_tv4 = validator.freshApi(); +validator.reset(); +validator.setErrorReporter(function (error, data, schema) { + return "Error code: " + error.code; +}); +validator.language('en-gb'); +validator.addLanguage('fr', {}); +validator.language('fr') +validator.addFormat('decimal-digits', function (data, schema) { + if (typeof data === 'string' && !/^[0-9]+$/.test(data)) { + return null; + } + return "must be string of decimal digits"; +}); +validator.addFormat({ + 'my-format': function (data: any, schema: any): string {return null;}, + 'other-format': function (data: any, schema: any): string {return 'oops';} +}); +function simpleFailure() {return true;} +function detailedFailure() {return true;} +validator.defineKeyword('my-custom-keyword', function (data, value, schema) { + if (simpleFailure()) { + return "Failure"; + } else if (detailedFailure()) { + return {code: validator.errorCodes['MY_CUSTOM_CODE'], message: {param1: 'a', param2: 'b'}}; + } else { + return null; + } +}); + + +// Demos +schema = { + "items": { + "type": "boolean" + } +}; +{ + let data1 = [true, false]; + let data2 = [true, 123]; + alert("data 1: " + validator.validate(data1, schema)); // true + alert("data 2: " + validator.validate(data2, schema)); // false + alert("data 2 error: " + JSON.stringify(validator.error, null, 4)); + + schema = { + "type": "array", + "items": {"$ref": "#"} + }; +} +{ +let data1 : any = [[], [[]]]; +let data2 : any = [[], [true, []]]; +alert("data 1: " + validator.validate(data1, schema)); // true +alert("data 2: " + validator.validate(data2, schema)); // false +} + +{ + schema = { + "type": "array", + "items": {"$ref": "http://example.com/schema" } + }; + let data = [1, 2, 3]; + alert("Valid: " + validator.validate(data, schema)); // true + alert("Missing schemas: " + JSON.stringify(validator.missing)); +} +{ + validator.addSchema("http://example.com/schema", { + "definitions": { + "arrayItem": {"type": "boolean"} + } + }); + let schema : tv4.JsonSchema = { + "type": "array", + "items": {"$ref": "http://example.com/schema#/definitions/arrayItem" } + }; + let data1 : any = [true, false, true]; + let data2 : any = [1, 2, 3]; + alert("data 1: " + validator.validate(data1, schema)); // true + alert("data 2: " + validator.validate(data2, schema)); // false +} + +// undocumented functions +var uri = ''; +obj = validator.normSchema(schema, uri); + + + From c1b3c6ff2743d0695ac8130ef03a0ee1ea0b27fd Mon Sep 17 00:00:00 2001 From: psnider Date: Thu, 3 Sep 2015 14:14:58 +0000 Subject: [PATCH 042/407] updated attribution --- tv4/tv4.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tv4/tv4.d.ts b/tv4/tv4.d.ts index 3ee5a2aed..5e762155a 100644 --- a/tv4/tv4.d.ts +++ b/tv4/tv4.d.ts @@ -1,7 +1,6 @@ // Type definitions for Tiny Validator tv4 1.2.5 // Project: https://github.com/geraintluff/tv4 -// Definitions by: Bart van der Schoor -// Definitions by: Peter Snider +// Definitions by: Bart van der Schoor , Peter Snider // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module tv4 { From e91c88f79e2e9fc4591988370252529537fb48ec Mon Sep 17 00:00:00 2001 From: tkQubo Date: Fri, 28 Aug 2015 21:34:25 +0900 Subject: [PATCH 043/407] Rename interfaces --- karma/karma.d.ts | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/karma/karma.d.ts b/karma/karma.d.ts index c66e6fe06..d6fbc6de9 100644 --- a/karma/karma.d.ts +++ b/karma/karma.d.ts @@ -6,19 +6,31 @@ declare module 'karma' { // See Karma public API https://karma-runner.github.io/0.12/dev/public-api.html - interface IKarmaServer { - start(options?: any, callback?: (exitCode: number) => void): void; + namespace karma { + interface Karma { + /** + * `start` method is deprecated since 0.13. It will be removed in 0.14. + * Please use + * + * server = new Server(config, [done]) + * server.start() + * + * instead. + */ + server: DeprecatedServer; + runner: Runner; + } + + interface DeprecatedServer { + start(options?: any, callback?: (exitCode: number) => void): void; + } + + interface Runner { + run(options?: any, callback?: (exitCode: number) => void): void; + } } - interface IKarmaRunner { - run(options?: any, callback?: (exitCode: number) => void): void; - } + var karma: karma.Karma; - interface IKarma { - server: IKarmaServer; - runner: IKarmaRunner; - } - - var karma: IKarma; export = karma; } From 85de2eeecfdf0ec8f8f0000ef5fd93a17ced704a Mon Sep 17 00:00:00 2001 From: tkQubo Date: Fri, 28 Aug 2015 23:36:08 +0900 Subject: [PATCH 044/407] Update definitions --- karma/karma-tests.ts | 40 ++++- karma/karma.d.ts | 338 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 369 insertions(+), 9 deletions(-) diff --git a/karma/karma-tests.ts b/karma/karma-tests.ts index b70e7273b..dd571f8ae 100644 --- a/karma/karma-tests.ts +++ b/karma/karma-tests.ts @@ -4,23 +4,51 @@ import gulp = require('gulp'); import karma = require('karma'); + function runKarma(singleRun: boolean): void { - karma.server.start({ - configFile: __dirname + '/karma.conf.js', - singleRun: singleRun - }); + // MEMO: `start` method is deprecated since 0.13. It will be removed in 0.14. + karma.server.start({ + configFile: __dirname + '/karma.conf.js', + singleRun: singleRun + }); } gulp.task('test:unit:karma', ['build:test:unit'], () => runKarma(true)); -karma.server.start({port: 9876}, (exitCode) => { + +karma.server.start({port: 9876}, (exitCode: number) => { console.log('Karma has exited with ' + exitCode); process.exit(exitCode); }); -karma.runner.run({port: 9876}, (exitCode) => { +karma.runner.run({port: 9876}, (exitCode: number) => { console.log('Karma has exited with ' + exitCode); process.exit(exitCode); }); + + +var Server = require('karma').Server; +var server = new Server({port: 9876}, function(exitCode: number) { + console.log('Karma has exited with ' + exitCode); + process.exit(exitCode); +}); + +server.start(); + +server.refreshFiles(); + +server.on('browser_register', function (browser: any) { + console.log('A new browser was registered'); +}); + +var runner = require('karma').runner; +runner.run({port: 9876}, function(exitCode: number) { + console.log('Karma has exited with ' + exitCode); + process.exit(exitCode); +}); + +// + +var captured: boolean = karma.launcher.areAllCaptured(); diff --git a/karma/karma.d.ts b/karma/karma.d.ts index d6fbc6de9..25bd114d2 100644 --- a/karma/karma.d.ts +++ b/karma/karma.d.ts @@ -1,10 +1,17 @@ -// Type definitions for karma v0.12.37 +// Type definitions for karma v0.13.9 // Project: https://github.com/karma-runner/karma // Definitions by: Tanguy Krotoff // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// +/// +/// + declare module 'karma' { // See Karma public API https://karma-runner.github.io/0.12/dev/public-api.html + import Promise = require('bluebird'); + import https = require('https'); + import log4js = require('log4js'); namespace karma { interface Karma { @@ -18,15 +25,340 @@ declare module 'karma' { * instead. */ server: DeprecatedServer; + Server: Server; runner: Runner; + launcher: Launcher; + VERSION: string; + } + + interface LauncherStatic { + generateId(): string; + //TODO: injector should be of type `di.Injector` + new(emitter: NodeJS.EventEmitter, injector: any): Launcher; + } + + interface Launcher { + Launcher: LauncherStatic; + //TODO: Can this return value ever be typified? + launch(names: string[], protocol: string, hostname: string, port: number, urlRoot: string): any[]; + kill(id: string, callback: Function): boolean; + restart(id: string): boolean; + killAll(callback: Function): void; + areAllCaptured(): boolean; + markCaptured(id: string): void; } interface DeprecatedServer { - start(options?: any, callback?: (exitCode: number) => void): void; + start(options?: Config, callback?: ServerCallback): void; } interface Runner { - run(options?: any, callback?: (exitCode: number) => void): void; + run(options?: Config, callback?: ServerCallback): void; + } + + interface Server extends NodeJS.EventEmitter { + new(options?: Config, callback?: ServerCallback): Server; + /** + * Start the server + */ + start(): void; + /** + * Get properties from the injector + * @param token + */ + get(token: string): any; + /** + * Force a refresh of the file list + */ + refreshFiles(): Promise; + + ///** + // * Backward-compatibility with karma-intellij bundled with WebStorm. + // * Deprecated since version 0.13, to be removed in 0.14 + // */ + //static start(): void; + } + + interface ServerCallback { + (exitCode: number): void; + } + + interface Config { + /** + * @description Enable or disable watching files and executing the tests whenever one of these files changes. + * @default true + */ + autoWatch?: boolean; + /** + * @description When Karma is watching the files for changes, it tries to batch multiple changes into a single run + * so that the test runner doesn't try to start and restart running tests more than it should. + * The configuration setting tells Karma how long to wait (in milliseconds) after any changes have occurred + * before starting the test process again. + * @default 250 + */ + autoWatchBatchDelay?: number; + /** + * @default '' + * @description The root path location that will be used to resolve all relative paths defined in files and exclude. + * If the basePath configuration is a relative path then it will be resolved to + * the __dirname of the configuration file. + */ + basePath?: string; + /** + * @default 2000 + * @description How long does Karma wait for a browser to reconnect (in ms). + *

+ * With a flaky connection it is pretty common that the browser disconnects, + * but the actual test execution is still running without any problems. Karma does not treat a disconnection + * as immediate failure and will wait browserDisconnectTimeout (ms). + * If the browser reconnects during that time, everything is fine. + *

+ */ + browserDisconnectTimeout?: number; + /** + * @default 0 + * @description The number of disconnections tolerated. + *

+ * The disconnectTolerance value represents the maximum number of tries a browser will attempt + * in the case of a disconnection. Usually any disconnection is considered a failure, + * but this option allows you to define a tolerance level when there is a flaky network link between + * the Karma server and the browsers. + *

+ */ + browserDisconnectTolerance?: number; + /** + * @default 10000 + * @description How long will Karma wait for a message from a browser before disconnecting from it (in ms). + *

+ * If, during test execution, Karma does not receive any message from a browser within + * browserNoActivityTimeout (ms), it will disconnect from the browser + *

+ */ + browserNoActivityTimeout?: number; + /** + * @default [] + * Possible Values: + *
    + *
  • Chrome (launcher comes installed with Karma)
  • + *
  • ChromeCanary (launcher comes installed with Karma)
  • + *
  • PhantomJS (launcher comes installed with Karma)
  • + *
  • Firefox (launcher requires karma-firefox-launcher plugin)
  • + *
  • Opera (launcher requires karma-opera-launcher plugin)
  • + *
  • Internet Explorer (launcher requires karma-ie-launcher plugin)
  • + *
  • Safari (launcher requires karma-safari-launcher plugin)
  • + *
+ * @description A list of browsers to launch and capture. When Karma starts up, it will also start up each browser + * which is placed within this setting. Once Karma is shut down, it will shut down these browsers as well. + * You can capture any browser manually by opening the browser and visiting the URL where + * the Karma web server is listening (by default it is http://localhost:9876/). + */ + browsers?: string[]; + /** + * @default 60000 + * @description Timeout for capturing a browser (in ms). + *

+ * The captureTimeout value represents the maximum boot-up time allowed for a + * browser to start and connect to Karma. If any browser does not get captured within the timeout, Karma + * will kill it and try to launch it again and, after three attempts to capture it, Karma will give up. + *

+ */ + captureTimeout?: number; + client?: ClientConfig; + /** + * @default true + * @description Enable or disable colors in the output (reporters and logs). + */ + colors?: boolean; + /** + * @default [] + * @description List of files/patterns to exclude from loaded files. + */ + exclude?: string[]; + /** + * @default [] + * @description List of files/patterns to load in the browser. + */ + files?: (FilePattern|string)[]; + /** + * @default [] + * @description List of test frameworks you want to use. Typically, you will set this to ['jasmine'], ['mocha'] or ['qunit']... + * Please note just about all frameworks in Karma require an additional plugin/framework library to be installed (via NPM). + */ + frameworks?: string[]; + /** + * @default 'localhost' + * @description Hostname to be used when capturing browsers. + */ + hostname?: string; + /** + * @default {} + * @description Options object to be used by Node's https class. + * Object description can be found in the + * [NodeJS.org API docs](https://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener) + */ + httpsServerOptions?: https.ServerOptions; + /** + * @default config.LOG_INFO + * Possible values: + *
    + *
  • config.LOG_DISABLE
  • + *
  • config.LOG_ERROR
  • + *
  • config.LOG_WARN
  • + *
  • config.LOG_INFO
  • + *
  • config.LOG_DEBUG
  • + *
+ * @description Level of logging. + */ + logLevel?: string; + /** + * @default [{type: 'console'}] + * @description A list of log appenders to be used. See the documentation for [log4js] for more information. + */ + loggers?: log4js.AppenderConfigBase[]; + /** + * @default ['karma-*'] + * @description List of plugins to load. A plugin can be a string (in which case it will be required + * by Karma) or an inlined plugin - Object. + * By default, Karma loads all sibling NPM modules which have a name starting with karma-*. + * Note: Just about all plugins in Karma require an additional library to be installed (via NPM). + */ + plugins?: any[]; + /** + * @default 9876 + * @description The port where the web server will be listening. + */ + port?: number; + /** + * @default {'**\/*.coffee': 'coffee'} + * @description A map of preprocessors to use. + * + * Preprocessors can be loaded through [plugins]. + * + * Note: Just about all preprocessors in Karma (other than CoffeeScript and some other defaults) + * require an additional library to be installed (via NPM). + * + * Be aware that preprocessors may be transforming the files and file types that are available at run time. For instance, + * if you are using the "coverage" preprocessor on your source files, if you then attempt to interactively debug + * your tests, you'll discover that your expected source code is completely changed from what you expected. Because + * of that, you'll want to engineer this so that your automated builds use the coverage entry in the "reporters" list, + * but your interactive debugging does not. + * + */ + preprocessors?: { [name: string]: string|string[] } + /** + * @default 'http:' + * Possible Values: + *
    + *
  • http:
  • + *
  • https:
  • + *
+ * @description Protocol used for running the Karma webserver. + * Determines the use of the Node http or https class. + * Note: Using 'https:' requires you to specify httpsServerOptions. + */ + protocol?: string; + /** + * @default {} + * @description A map of path-proxy pairs. + */ + proxies?: { [path: string]: string } + /** + * @default true + * @description Whether or not Karma or any browsers should raise an error when an inavlid SSL certificate is found. + */ + proxyValidateSSL?: boolean; + /** + * @default 0 + * @description Karma will report all the tests that are slower than given time limit (in ms). + * This is disabled by default (since the default value is 0). + */ + reportSlowerThan?: number; + /** + * @default ['progress'] + * Possible Values: + *
    + *
  • dots
  • + *
  • progress
  • + *
+ * @description A list of reporters to use. + * Additional reporters, such as growl, junit, teamcity or coverage can be loaded through plugins. + * Note: Just about all additional reporters in Karma (other than progress) require an additional library to be installed (via NPM). + */ + reporters?: string[]; + /** + * @default false + * @description Continuous Integration mode. + * If true, Karma will start and capture all configured browsers, run tests and then exit with an exit code of 0 or 1 depending + * on whether all tests passed or any tests failed. + */ + singleRun?: boolean; + /** + * @default ['polling', 'websocket'] + * @description An array of allowed transport methods between the browser and testing server. This configuration setting + * is handed off to [socket.io](http://socket.io/) (which manages the communication + * between browsers and the testing server). + */ + transports?: string[]; + /** + * @default '/' + * @description The base url, where Karma runs. + * All of Karma's urls get prefixed with the urlRoot. This is helpful when using proxies, as + * sometimes you might want to proxy a url that is already taken by Karma. + */ + urlRoot?: string; + } + + interface ClientConfig { + /** + * @default undefined + * @description When karma run is passed additional arguments on the command-line, they + * are passed through to the test adapter as karma.config.args (an array of strings). + * The client.args option allows you to set this value for actions other than run. + * How this value is used is up to your test adapter - you should check your adapter's + * documentation to see how (and if) it uses this value. + */ + args?: string[]; + /** + * @default true + * @description Run the tests inside an iFrame or a new window + * If true, Karma runs the tests inside an iFrame. If false, Karma runs the tests in a new window. Some tests may not run in an + * iFrame and may need a new window to run. + */ + useIframe?: boolean; + /** + * @default true + * @description Capture all console output and pipe it to the terminal. + */ + captureConsole?: boolean; + } + + interface FilePattern { + /** + * The pattern to use for matching. This property is mandatory. + */ + pattern: string; + /** + * @default true + * @description If autoWatch is true all files that have set watched to true will be watched + * for changes. + */ + watched?: boolean; + /** + * @default true + * @description Should the files be included in the browser using '); + +Handlebars.helpers !== undefined; diff --git a/handlebars/handlebars.d.ts b/handlebars/handlebars.d.ts index 652685724..9a0aa510a 100644 --- a/handlebars/handlebars.d.ts +++ b/handlebars/handlebars.d.ts @@ -18,6 +18,7 @@ declare module Handlebars { export var Utils: typeof hbs.Utils; export var logger: Logger; export var templates: HandlebarsTemplates; + export var helpers: any; export module AST { export var helpers: hbs.AST.helpers; From cdffc42fd4b5156db21099ea6a701b41487142a8 Mon Sep 17 00:00:00 2001 From: Makis Maropoulos Date: Thu, 10 Sep 2015 05:32:04 +0300 Subject: [PATCH 115/407] I moved the project, update the project's url here also --- node-mysql-wrapper/node-mysql-wrapper.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-mysql-wrapper/node-mysql-wrapper.d.ts b/node-mysql-wrapper/node-mysql-wrapper.d.ts index 7ea67ef3c..af100bbf4 100644 --- a/node-mysql-wrapper/node-mysql-wrapper.d.ts +++ b/node-mysql-wrapper/node-mysql-wrapper.d.ts @@ -1,5 +1,5 @@ // Type definitions for node-mysql-wrapper -// Project: https://github.com/kataras/node-mysql-wrapper +// Project: https://github.com/nodets/node-mysql-wrapper // Definitions by: Makis Maropoulos // Definitions: https://github.com/borisyankov/DefinitelyTyped From 135ca5e53f69322235a9bf000d28a864ff01bfea Mon Sep 17 00:00:00 2001 From: herrmanno Date: Thu, 10 Sep 2015 09:41:11 +0200 Subject: [PATCH 116/407] Added observe-js definition --- observe-js/observe-js-test.ts | 111 +++++++++++++++ observe-js/observe-js.d.ts | 250 ++++++++++++++++++++++++++++++++++ 2 files changed, 361 insertions(+) create mode 100644 observe-js/observe-js-test.ts create mode 100644 observe-js/observe-js.d.ts diff --git a/observe-js/observe-js-test.ts b/observe-js/observe-js-test.ts new file mode 100644 index 000000000..37ad0216c --- /dev/null +++ b/observe-js/observe-js-test.ts @@ -0,0 +1,111 @@ +/// + +module observejs { + + function Test_PathObserver() { + var obj = { foo: { bar: 'baz' } }; + var defaultValue = 42; + var observer = new PathObserver(obj, 'foo.bar', defaultValue); + observer.open(function(newValue, oldValue) { + // respond to obj.foo.bar having changed value. + }); + } + + + function Test_ArrayObserver() { + var arr = [0, 1, 2, 4]; + var observer = new ArrayObserver(arr); + observer.open(function(splices) { + // respond to changes to the elements of arr. + splices.forEach(function(splice) { + splice.index; // the index position that the change occurred. + splice.removed; // an array of values representing the sequence of removed elements + splice.addedCount; // the number of elements which were inserted. + }); + }); + } + + function Test_ObejctObserver() { + var myObj = { id: 1, foo: 'bar' }; + var observer = new ObjectObserver(myObj); + observer.open(function(added, removed, changed, getOldValueFn) { + // respond to changes to the obj. + Object.keys(added).forEach(function(property) { + property; // a property which has been been added to obj + added[property]; // its value + }); + Object.keys(removed).forEach(function(property) { + property; // a property which has been been removed from obj + getOldValueFn(property); // its old value + }); + Object.keys(changed).forEach(function(property) { + property; // a property on obj which has changed value. + changed[property]; // its value + getOldValueFn(property); // its old value + }); + }); + } + + function Test_CompounObserver() { + var obj = { + a: 1, + b: 2, + }; + + var otherObj = { c: 3 }; + + var observer = new CompoundObserver(); + observer.addPath(obj, 'a'); + observer.addObserver(new PathObserver(obj, 'b')); + observer.addPath(otherObj, 'c'); + var logTemplate = 'The %sth value before & after:'; + observer.open(function(newValues, oldValues) { + // Use for-in to iterate which values have changed. + for (var i in oldValues) { + console.log(logTemplate, i, oldValues[i], newValues[i]); + } + }); + } + + function Test_ObserverTransform_1() { + var obj = { value: 10 }; + var observer = new PathObserver(obj, 'value'); + function getValue(value:any) { return value * 2 }; + function setValue(value:any) { return value / 2 }; + + var transform = new ObserverTransform(observer, getValue, setValue); + + // returns 20. + transform.open(function(newValue, oldValue) { + console.log('new: ' + newValue + ', old: ' + oldValue); + }); + + obj.value = 20; + transform.deliver(); // 'new: 40, old: 20' + transform.setValue(4); // obj.value === 2; + } + + function Test_ObserverTransform_2() { + var obj = { a: 1, b: 2, c: 3 }; + var observer = new CompoundObserver(); + observer.addPath(obj, 'a'); + observer.addPath(obj, 'b'); + observer.addPath(obj, 'c'); + var transform = new ObserverTransform(observer, function(values) { + var value = 0; + for (var i = 0; i < values.length; i++) + value += values[i] + return value; + }); + + // returns 6. + transform.open(function(newValue, oldValue) { + console.log('new: ' + newValue + ', old: ' + oldValue); + }); + + obj.a = 2; + obj.c = 10; + transform.deliver(); // 'new: 14, old: 6' + } + +} \ No newline at end of file diff --git a/observe-js/observe-js.d.ts b/observe-js/observe-js.d.ts new file mode 100644 index 000000000..abd2caa00 --- /dev/null +++ b/observe-js/observe-js.d.ts @@ -0,0 +1,250 @@ +// Type definitions for observe-js v0.5.5 +// Project: https://github.com/Polymer/observe-js +// Definitions by: Oliver Herrmann +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module observejs { + + /*---------------------- + Observable + ----------------------*/ + + interface Observable { + /** + * Begins observation. + * @param onChange the function that gets invoked if a change is detected + * @param the target of observation + */ + open(onChange:(newValue:any, oldValue:any)=>any, receiver?:any):void + + /** + * Report any changes now (does nothing if there are no changes to report). + */ + deliver(): void + + /** + * If there are changes to report, ignore them. Returns the current value of the observation. + */ + discardChanges():void + + /** + * Ends observation. Frees resources and drops references to observed objects. + */ + close():void + } + + + /*---------------------- + PathObserver + ----------------------*/ + + interface PathObserver_static { + /** + * Constructor + * @param receiver the target for observation + * @param path specifies the paht to observe. If path === '' the receiver itself gets observed. + * @param defaultValue the defaultValue + */ + new(receiver:any, path:string, defaultValue?:any): PathObserver_instance + } + + interface PathObserver_instance extends Observable { + /** + * sets the observed value without notifying about the change. + * @param value the value to set + */ + setValue(value:any): void + } + + /** + * Observes a "value-at-a-path" from a given object: + */ + var PathObserver: PathObserver_static + + + /*---------------------- + ArrayObserver + ----------------------*/ + + interface splice { + + /** + * the index position that the change occured + */ + index:number + + /** + * an array of values representing the sequence of removed elements + */ + removed: Array + + /** + * the number of element which were inserted + */ + addedCount:number + } + + interface ArrayObserver_static { + + /** + * Constructor + * @param receiver the target for observation + */ + new(receiver:Array): ArrayObserver_instance + + /** + * transforms a copy of an old state of an array into a copy of its current state. + * @param previous array of old state + * @param current array of current state + * @param splices splices to apply + */ + applySplices(previous:Array, current:Array, splices:Array):void + } + + interface ArrayObserver_instance extends Observable { + open(onChange:(splices:Array)=>any):void + } + + /** + * ArrayObserver observes the index-positions of an Array and reports changes as the minimal set of "splices" which would have had the same effect. + */ + var ArrayObserver: ArrayObserver_static + + + /*---------------------- + ObjectObserver + ----------------------*/ + + interface Properties { + [key:string]:any + } + + interface ObjectObserver_static { + + /** + * Constructor + * @param receiver the target for observation + */ + new(receiver:any): ObjectObserver_instance + } + + interface ObjectObserver_instance extends Observable { + open(onChange:(added:Properties, removed:Properties, changed:Properties, getOldValueFn:(property:string)=>any)=>any):void + } + + /** + * Observes the set of own-properties of an object and their values + */ + var ObjectObserver: ObjectObserver_static + + + /*---------------------- + CompounObserver + ----------------------*/ + + interface CompoundObserver_static { + + /** + * Constructor + */ + new(): CompoundObserver_instance + } + + interface CompoundObserver_instance extends Observable { + open(onChange:(newValues:Array, oldValue:Array)=>any):void + + /** + * Adds the receivers property at the specified path to the list of observables. + * @param receiver the target for observation + * @param path specifies the paht to observe. If path === '' the receiver itself gets observed. + */ + addPath(receiver:any, path:string):void + + /** + * Adds an Observer to the list of observables. + */ + addObserver(observer:Observable):void + + } + + /** + * CompoundObserver allows simultaneous observation of multiple paths and/or Observables. + */ + var CompoundObserver: CompoundObserver_static + + + + /*---------------------- + ObserverTransform + ----------------------*/ + + interface ObserverTransform_static { + + /** + * Constructor + * @param observer the observer to transform + * @param getValue function that proxys getting a value + * @param setValue function that proxys setting a value + */ + new(observer:Observable, getValue:(value:any)=>any, setValue:(value:any)=>any): ObserverTransform_instance + + /** + * Constructor + * @param observer the observer to transform + * @param valueFn function that gets invoked with all observed values. May return a single new value. + */ + new(observer:Observable, valueFn:(values:Array)=>any): ObserverTransform_instance + } + + interface ObserverTransform_instance extends Observable { + /** + * sets the observed value without notifying about the change. + * @param value the value to set + */ + setValue(value:any): void + } + + /** + * CompoundObserver allows simultaneous observation of multiple paths and/or Observables. + */ + var ObserverTransform: ObserverTransform_static + + + /*---------------------- + Path + ----------------------*/ + + interface Path { + + /** + * Returns the current value of the path from the provided object. If eval() is available, + * a compiled getter will be used for better performance. Like PathObserver above, undefined + * is returned unless you provide an overriding defaultValue. + */ + getValueFrom(object:any, defaultValue:any): any + + /** + * Attempts to set the value of the path from the provided object. Returns true IFF the path + * was reachable and set. + */ + getValueFrom(object:any, newValue:any): any + } +} + +declare module "observejs" { + var PathObserver: typeof observejs.PathObserver; + var ArrayObserver: typeof observejs.ArrayObserver; + var ObjectObserver: typeof observejs.ObjectObserver; + var CompoundObserver: typeof observejs.CompoundObserver; + var ObserverTransform: typeof observejs.ObserverTransform; + var Path: observejs.Path; + + export { + PathObserver, + ArrayObserver, + ObjectObserver, + CompoundObserver, + ObserverTransform, + Path + }; +} \ No newline at end of file From 2332fe2eaaed877248ac845491821cc5eb4179e5 Mon Sep 17 00:00:00 2001 From: Ritzlgrmft Date: Thu, 10 Sep 2015 10:36:36 +0200 Subject: [PATCH 117/407] Definitions added for Cordova plugin cordova-plugin-app-version (https://github.com/whiteoctober/cordova-plugin-app-version). --- cordova-plugin-app-version/appversion-tests.ts | 18 ++++++++++++++++++ cordova-plugin-app-version/appversion.d.ts | 8 ++++++++ 2 files changed, 26 insertions(+) create mode 100644 cordova-plugin-app-version/appversion-tests.ts create mode 100644 cordova-plugin-app-version/appversion.d.ts diff --git a/cordova-plugin-app-version/appversion-tests.ts b/cordova-plugin-app-version/appversion-tests.ts new file mode 100644 index 000000000..89858c3e5 --- /dev/null +++ b/cordova-plugin-app-version/appversion-tests.ts @@ -0,0 +1,18 @@ +/// +/// +cordova.getAppVersion.getAppName() + .then(appName=> { + console.log(appName) + }); +cordova.getAppVersion.getPackageName() + .then(packageName=> { + console.log(packageName); + }); +cordova.getAppVersion.getVersionCode() + .then(versionCode=> { + console.log(versionCode); + }); +cordova.getAppVersion.getVersionNumber() + .then(versionNumber=> { + console.log(versionNumber); + }); \ No newline at end of file diff --git a/cordova-plugin-app-version/appversion.d.ts b/cordova-plugin-app-version/appversion.d.ts new file mode 100644 index 000000000..4069e38da --- /dev/null +++ b/cordova-plugin-app-version/appversion.d.ts @@ -0,0 +1,8 @@ +interface Cordova { + getAppVersion: { + getAppName: () => ng.IPromise; + getPackageName: () => ng.IPromise; + getVersionCode: () => ng.IPromise; + getVersionNumber: () => ng.IPromise; + }; +} \ No newline at end of file From bc072529810ab95bc0abc0098b1eeb4bf0cff629 Mon Sep 17 00:00:00 2001 From: progre Date: Thu, 10 Sep 2015 20:02:57 +0900 Subject: [PATCH 118/407] Add birthtime to fs.Stats --- node/node.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/node/node.d.ts b/node/node.d.ts index b7edca1f7..4fc3332a6 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1062,6 +1062,7 @@ declare module "fs" { atime: Date; mtime: Date; ctime: Date; + birthtime: Date; } interface FSWatcher extends events.EventEmitter { From 7c44bc25f0a1ea0528378c50db21c3ebccfaa662 Mon Sep 17 00:00:00 2001 From: Zuo Haocheng Date: Thu, 10 Sep 2015 20:44:39 +0800 Subject: [PATCH 119/407] should-promised: Update definition for fulfilled and rejected --- should-promised/should-promised-tests.ts | 4 ++-- should-promised/should-promised.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/should-promised/should-promised-tests.ts b/should-promised/should-promised-tests.ts index 03167e663..50ea0b59a 100644 --- a/should-promised/should-promised-tests.ts +++ b/should-promised/should-promised-tests.ts @@ -7,9 +7,9 @@ var promise: Promise = new Promise(function (resolve, reject) {} promise.should.be.Promise; (10).should.not.be.a.Promise; -promise.should.be.fulfilled; +promise.should.be.fulfilled(); -promise.should.be.rejected; +promise.should.be.rejected(); promise.should.be.rejectedWith(Error); promise.should.be.rejectedWith('boom'); diff --git a/should-promised/should-promised.d.ts b/should-promised/should-promised.d.ts index c6c95ba98..f7e2a97f5 100644 --- a/should-promised/should-promised.d.ts +++ b/should-promised/should-promised.d.ts @@ -5,8 +5,8 @@ interface ShouldAssertion { Promise: ShouldAssertion; - fulfilled: ShouldAssertion; - rejected: ShouldAssertion; + fulfilled(): ShouldAssertion; + rejected(): ShouldAssertion; rejectedWith(message: (string | Function | RegExp), properties?: Object): ShouldAssertion; rejectedWith(message: Object): ShouldAssertion; finally: ShouldAssertion; From 18c31c7a2519f4390dadeee0f9486764661c3826 Mon Sep 17 00:00:00 2001 From: Joe Skeen Date: Thu, 10 Sep 2015 07:15:14 -0600 Subject: [PATCH 120/407] change rowEntity type to be `any` --- ui-grid/ui-grid.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 5cc3886f7..c41cac7c6 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -2823,12 +2823,12 @@ declare module uiGrid { * returns all selected rows as gridRows * @returns {Array} The selected rows */ - getSelectedGridRows(): Array; + getSelectedGridRows(): Array; /** * Gets selected rows as entities * @returns {Array} Selected row entities */ - getSelectedRows(): Array; + getSelectedRows(): Array; /** * Selects all rows. Does nothing if multiselect = false * @param {ng.IAngularEvent} event object if raised from event @@ -2844,7 +2844,7 @@ declare module uiGrid { * @param {any} rowEntity gridOptions.data[] array value * @param {ng.IAngularEvent} event object if raised from event */ - selectRow(rowEntity: uiGrid.IGridRow, event?: ng.IAngularEvent): void; + selectRow(rowEntity: any, event?: ng.IAngularEvent): void; /** * Select the specified row by visible index * (i.e. if you specify row 0 you'll get the first visible row selected). @@ -2871,13 +2871,13 @@ declare module uiGrid { * @param {any} rowEntity gridOptions.data[] array value * @param {ng.IAngularEvent} event object if raised from event */ - toggleRowSelection(rowEntity: uiGrid.IGridRow, event?: ng.IAngularEvent): void; + toggleRowSelection(rowEntity: any, event?: ng.IAngularEvent): void; /** * UnSelect the data row * @param {any} rowEntity gridOptions.data[] array value * @param {ng.IAngularEvent} event object if raised from event */ - unSelectRow(rowEntity: uiGrid.IGridRow, event?: ng.IAngularEvent): void; + unSelectRow(rowEntity: any, event?: ng.IAngularEvent): void; // Events on: { From 02f03824f17d974d2517f5fbb39540e351c6b7d3 Mon Sep 17 00:00:00 2001 From: Pavel Bakshy Date: Thu, 10 Sep 2015 17:47:36 +0300 Subject: [PATCH 121/407] ko.plus: Replaced Callback type with Function --- ko.plus/ko.plus-tests.ts | 2 ++ ko.plus/ko.plus.d.ts | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ko.plus/ko.plus-tests.ts b/ko.plus/ko.plus-tests.ts index 992332e2b..7dd1053b2 100644 --- a/ko.plus/ko.plus-tests.ts +++ b/ko.plus/ko.plus-tests.ts @@ -43,6 +43,8 @@ function CommandTests() { action: () => { return "Hello cmd4"; } }); + // initialize command with action with typed argument + var cmd5 = ko.command((message: string) => { return message; }); // test execute the command cmd1(); diff --git a/ko.plus/ko.plus.d.ts b/ko.plus/ko.plus.d.ts index 65301aa7c..dacf6121f 100644 --- a/ko.plus/ko.plus.d.ts +++ b/ko.plus/ko.plus.d.ts @@ -23,7 +23,7 @@ // interface KnockoutStatic { // create a command - two overloads - command: (param: KoPlus.Callback | KoPlus.CommandOptions) => KoPlus.Command; + command: (param: Function | KoPlus.CommandOptions) => KoPlus.Command; editable: KoPlus.EditableStatic; editableArray: KoPlus.EditableArrayStatic; @@ -60,8 +60,6 @@ interface KnockoutBindingHandlers { // namespace for ko.plus types // declare module KoPlus { - // predefine a callback type - export type Callback = () => void; //#region Command types @@ -91,9 +89,9 @@ declare module KoPlus { fail: (callback: (error: string) => void) => Command; - always: (callback: Callback) => Command; + always: (callback: Function) => Command; - then: (resolve: Callback, reject: Callback) => Command; + then: (resolve: Function, reject: Function) => Command; } // @@ -102,7 +100,7 @@ declare module KoPlus { // export interface CommandOptions { // [required] sets the command action method - action: Callback; + action: Function; // [optional] function to determine if command can be executed canExecute?: () => boolean; From 9d8cbdb263e5d69de355a24aeb1465c8400c924a Mon Sep 17 00:00:00 2001 From: Paul Jolly Date: Wed, 9 Sep 2015 16:05:42 +0100 Subject: [PATCH 122/407] Correctly type d3.event --- d3/d3-tests.ts | 86 ++++++++++++++++++++++++++------------------------ d3/d3.d.ts | 31 ++++++++++++++---- 2 files changed, 68 insertions(+), 49 deletions(-) diff --git a/d3/d3-tests.ts b/d3/d3-tests.ts index 105e8f29c..414a2346e 100644 --- a/d3/d3-tests.ts +++ b/d3/d3-tests.ts @@ -139,7 +139,7 @@ function groupedBarChart() { .style("text-anchor", "end") .text("Population"); - var state = svg.selectAll(".state") + var state = svg.selectAll(".state") .data(data) .enter().append("g") .attr("class", "g") @@ -672,8 +672,8 @@ function dragMultiples() { function dragmove(d: { x: number; y: number }) { d3.select(this) - .attr("cx", d.x = Math.max(radius, Math.min(width - radius, ( d3.event).x))) - .attr("cy", d.y = Math.max(radius, Math.min(height - radius, ( d3.event).y))); + .attr("cx", d.x = Math.max(radius, Math.min(width - radius, ( d3.event).x))) + .attr("cy", d.y = Math.max(radius, Math.min(height - radius, ( d3.event).y))); } } @@ -873,7 +873,7 @@ function populationPyramid() { // Allow the arrow keys to change the displayed year. window.focus(); d3.select(window).on("keydown", function () { - switch (d3.event.keyCode) { + switch (( d3.event).keyCode) { case 37: year = Math.max(year0, year - 10); break; case 39: year = Math.min(year1, year + 10); break; } @@ -1167,7 +1167,7 @@ function azimuthalEquidistant() { .translate([width / 2, height / 2]) .clipAngle(180 - 1e-3) .precision(.1); - + var path = d3.geo.path() .projection(projection); @@ -1209,7 +1209,7 @@ function azimuthalEquidistant() { d3.select(self.frameElement).style("height", height + "px"); } - + //Example from http://bl.ocks.org/mbostock/4060366 function voronoiTesselation() { var width = 960, @@ -1237,7 +1237,7 @@ function voronoiTesselation() { .attr("r", 2); redraw(); - + function redraw() { path = path.data(voronoi(vertices).map(function (d) { return "M" + d.join("L") + "Z"; } ), String); path.exit().remove(); @@ -1254,7 +1254,7 @@ function forceDirectedVoronoi() { simulate = true, zoomToAdd = true, color = d3.scale.quantize().domain([10000, 7250]).range(["#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]) - + var numVertices = (w*h) / 3000; var vertices = d3.range(numVertices).map(function(i) { var angle = radius * (i+10); @@ -1266,15 +1266,15 @@ function forceDirectedVoronoi() { var prevEventScale = 1; var zoom = d3.behavior.zoom().on("zoom", function(d,i) { if (zoomToAdd){ - if (( d3.event).scale > prevEventScale) { - var angle = radius * vertices.length; - vertices.push({x: angle*Math.cos(angle)+(w/2), y: angle*Math.sin(angle)+(h/2)}) - } else if (vertices.length > 2 && ( d3.event).scale != prevEventScale) { - vertices.pop(); - } - force.nodes(vertices).start() + if (( d3.event).scale > prevEventScale) { + var angle = radius * vertices.length; + vertices.push({x: angle*Math.cos(angle)+(w/2), y: angle*Math.sin(angle)+(h/2)}) + } else if (vertices.length > 2 && ( d3.event).scale != prevEventScale) { + vertices.pop(); + } + force.nodes(vertices).start() } else { - if (( d3.event).scale > prevEventScale) { + if (( d3.event).scale > prevEventScale) { radius+= .01 } else { radius -= .01 @@ -1285,18 +1285,18 @@ function forceDirectedVoronoi() { }); force.nodes(vertices).start() } - prevEventScale = ( d3.event).scale; + prevEventScale = ( d3.event).scale; }); - + d3.select(window) .on("keydown", function() { // shift - if(d3.event.keyCode == 16) { + if(( d3.event).keyCode == 16) { zoomToAdd = false } - + // s - if(d3.event.keyCode == 83) { + if(( d3.event).keyCode == 83) { simulate = !simulate if(simulate) { force.start() @@ -1308,38 +1308,38 @@ function forceDirectedVoronoi() { .on("keyup", function() { zoomToAdd = true }) - + var svg = d3.select("#chart") .append("svg") .attr("width", w) .attr("height", h) .call(zoom) - + var force = d3.layout.force() .charge(-300) .size([w, h]) .on("tick", update); - + force.nodes(vertices).start(); - + var circle = > svg.selectAll("circle"); var path = > svg.selectAll("path"); var link = > svg.selectAll("line"); - + function update() { path = path.data(d3_geom_voronoi(vertices)); path.enter().append("path") // drag node by dragging cell .call(d3.behavior.drag() .on("drag", function(d, i) { - vertices[i] = {x: vertices[i].x + ( d3.event).dx, y: vertices[i].y + ( d3.event).dy} + vertices[i] = {x: vertices[i].x + ( d3.event).dx, y: vertices[i].y + ( d3.event).dy} }) ) .style("fill", function(d, i) { return color(0) }) path.attr("d", function(d) { return "M" + d.join("L") + "Z"; }) .transition().duration(150).style("fill", function(d, i) { return color(d3.geom.polygon(d).area()) }) path.exit().remove(); - + circle = circle.data(vertices) circle.enter().append("circle") .attr("r", 0) @@ -1347,16 +1347,16 @@ function forceDirectedVoronoi() { circle.attr("cx", function(d) { return d.x; }) .attr("cy", function(d) { return d.y; }); circle.exit().transition().attr("r", 0).remove(); - + link = link.data(d3_geom_voronoi.links(vertices)) link.enter().append("line") link.attr("x1", function(d) { return d.source.x; }) .attr("y1", function(d) { return d.source.y; }) .attr("x2", function(d) { return d.target.x; }) .attr("y2", function(d) { return d.target.y; }) - + link.exit().remove() - + if(!simulate) force.stop() } } @@ -1521,7 +1521,7 @@ module hierarchicalEdgeBundling { .value(function (d) { return d.size; } ); var bundle = d3.layout.bundle(); - + var line = d3.svg.line.radial() .interpolate("bundle") .tension(.85) @@ -1851,7 +1851,7 @@ function chordDiagram() { [8010, 16145, 8090, 8045], [1013, 990, 940, 6907] ]; - + var chord = d3.layout.chord() .padding(.05) .sortSubgroups(d3.descending) @@ -2031,7 +2031,7 @@ function irisParallel() { } function drag(d: string) { - x.range()[i] = ( d3.event).x; + x.range()[i] = ( d3.event).x; traits.sort(function (a, b) { return x(a) - x(b); } ); g.attr("transform", function (d) { return "translate(" + x(d) + ")"; } ); foreground.attr("d", path); @@ -2085,14 +2085,14 @@ function healthAndWealth() { // The x & y axes. var xAxis = d3.svg.axis().orient("bottom").scale(xScale).ticks(12, d3.format(",d")), yAxis = d3.svg.axis().scale(yScale).orient("left"); - + // Create the SVG container and set the origin. var svg = d3.select("#chart").append("svg") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); - + // Add the x-axis. svg.append("g") .attr("class", "x axis") @@ -2152,7 +2152,7 @@ function healthAndWealth() { // Add an overlay for the year label. var box = (label.node()).getBBox(); - + var overlay = svg.append("rect") .attr("class", "overlay") .attr("x", box.x) @@ -2669,12 +2669,14 @@ function multiTest() { function testD3Events () { d3.select('svg') .on('click', () => { - var coords = [d3.event.pageX, d3.event.pageY]; - console.log("clicked", d3.event.target, "at " + coords); + let e = d3.event; + var coords = [e.pageX, e.pageY]; + console.log("clicked", e.target, "at " + coords); }) .on('keypress', () => { - if (d3.event.shiftKey) { - console.log('shift + ' + d3.event.which); + let e = d3.event; + if (e.shiftKey) { + console.log('shift + ' + e.which); } }); } @@ -2690,4 +2692,4 @@ function testD3MutlieTimeFormat() { ["%B", function(d) { return d.getMonth(); }], ["%Y", function() { return true; }] ]); -} \ No newline at end of file +} diff --git a/d3/d3.d.ts b/d3/d3.d.ts index ef3909e9f..2d1b20c3b 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -807,7 +807,7 @@ declare module d3 { interface Transition { transition(): Transition; - + delay(): number; delay(delay: number): Transition; delay(delay: (datum: Datum, index: number, outerIndex: number) => number): Transition; @@ -920,16 +920,33 @@ declare module d3 { export function flush(): void; } - /** - * Interface for any and all d3 events. - */ - interface Event extends KeyboardEvent, MouseEvent { - } + interface BaseEvent { + type: string; + sourceEvent?: Event; + } + + /** + * Define a D3-specific ZoomEvent per https://github.com/mbostock/d3/wiki/Zoom-Behavior#event + */ + interface ZoomEvent extends BaseEvent { + scale: number; + translate: [number, number]; + } + + /** + * Define a D3-specific DragEvent per https://github.com/mbostock/d3/wiki/Drag-Behavior#on + */ + interface DragEvent extends BaseEvent { + x: number; + y: number; + dx: number; + dy: number; + } /** * The current event's value. Use this variable in a handler registered with `selection.on`. */ - export var event: Event; + export var event: Event | BaseEvent; /** * Returns the x and y coordinates of the mouse relative to the provided container element, using d3.event for the mouse's position on the page. From b33f6c6dedba3dd7d251408008f1d0ab995e4fe0 Mon Sep 17 00:00:00 2001 From: David Pfeffer Date: Thu, 10 Sep 2015 14:59:43 -0400 Subject: [PATCH 123/407] Maintains type safety through a safeApply. --- rx-angular/rx.angular.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rx-angular/rx.angular.d.ts b/rx-angular/rx.angular.d.ts index e2d0ec8c5..2b82e529a 100644 --- a/rx-angular/rx.angular.d.ts +++ b/rx-angular/rx.angular.d.ts @@ -10,7 +10,7 @@ declare module Rx { interface IObservable { - safeApply($scope: ng.IScope, callback: (data: any) => void): Rx.Observable; + safeApply($scope: ng.IScope, callback: (data: T) => void): Rx.Observable; } } From 0b26f2d03de4551ebc3196bf7e3ae8d937f64fff Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 10 Sep 2015 10:50:42 -0700 Subject: [PATCH 124/407] angular2-2.0.0-alpha.37 --- angular2/angular2-2.0.0-alpha.37.d.ts | 12214 ++++++++++++++++++++++++ angular2/angular2-tests.ts | 8 +- angular2/angular2.d.ts | 7000 +++++++++++++- angular2/http-2.0.0-alpha.37.d.ts | 1007 ++ angular2/http.d.ts | 1007 ++ angular2/router-2.0.0-alpha.35.d.ts | 18 +- angular2/router-2.0.0-alpha.36.d.ts | 18 +- angular2/router-2.0.0-alpha.37.d.ts | 738 ++ angular2/router.d.ts | 505 +- 9 files changed, 21911 insertions(+), 604 deletions(-) create mode 100644 angular2/angular2-2.0.0-alpha.37.d.ts create mode 100644 angular2/http-2.0.0-alpha.37.d.ts create mode 100644 angular2/http.d.ts create mode 100644 angular2/router-2.0.0-alpha.37.d.ts diff --git a/angular2/angular2-2.0.0-alpha.37.d.ts b/angular2/angular2-2.0.0-alpha.37.d.ts new file mode 100644 index 000000000..733c9e8ef --- /dev/null +++ b/angular2/angular2-2.0.0-alpha.37.d.ts @@ -0,0 +1,12214 @@ +// Type definitions for Angular v2.0.0-alpha.37 +// Project: http://angular.io/ +// Definitions by: angular team +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// *********************************************************** +// This file is generated by the Angular build process. +// Please do not create manual edits or send pull requests +// modifying this file. +// *********************************************************** + +// angular2/angular2 depends transitively on these libraries. +// If you don't have them installed you can install them using TSD +// https://github.com/DefinitelyTyped/tsd + +/// +/// +// angular2/web_worker/worker depends transitively on these libraries. +// If you don't have them installed you can install them using TSD +// https://github.com/DefinitelyTyped/tsd + +/// +/// +// angular2/web_worker/ui depends transitively on these libraries. +// If you don't have them installed you can install them using TSD +// https://github.com/DefinitelyTyped/tsd + +/// +/// + + +interface Map {} +interface StringMap extends Map {} + + +declare module ng { + // See https://github.com/Microsoft/TypeScript/issues/1168 + class BaseException /* extends Error */ { + message: string; + stack: string; + toString(): string; + } + interface InjectableReference {} +} + +declare module ngWorker { + // See https://github.com/Microsoft/TypeScript/issues/1168 + class BaseException /* extends Error */ { + message: string; + stack: string; + toString(): string; + } + interface InjectableReference {} +} + +declare module ngUi { + // See https://github.com/Microsoft/TypeScript/issues/1168 + class BaseException /* extends Error */ { + message: string; + stack: string; + toString(): string; + } + interface InjectableReference {} +} + + + + + +/** + * The `angular2` is the single place to import all of the individual types. + */ +declare module ng { + + /** + * Bootstrapping for Angular applications. + * + * You instantiate an Angular application by explicitly specifying a component to use as the root + * component for your + * application via the `bootstrap()` method. + * + * ## Simple Example + * + * Assuming this `index.html`: + * + * ```html + * + * + * + * loading... + * + * + * ``` + * + * An application is bootstrapped inside an existing browser DOM, typically `index.html`. Unlike + * Angular 1, Angular 2 + * does not compile/process bindings in `index.html`. This is mainly for security reasons, as well + * as architectural + * changes in Angular 2. This means that `index.html` can safely be processed using server-side + * technologies such as + * bindings. Bindings can thus use double-curly `{{ syntax }}` without collision from Angular 2 + * component double-curly + * `{{ syntax }}`. + * + * We can use this script code: + * + * ``` + * @Component({ + * selector: 'my-app' + * }) + * @View({ + * template: 'Hello {{ name }}!' + * }) + * class MyApp { + * name:string; + * + * constructor() { + * this.name = 'World'; + * } + * } + * + * main() { + * return bootstrap(MyApp); + * } + * ``` + * + * When the app developer invokes `bootstrap()` with the root component `MyApp` as its argument, + * Angular performs the + * following tasks: + * + * 1. It uses the component's `selector` property to locate the DOM element which needs to be + * upgraded into + * the angular component. + * 2. It creates a new child injector (from the platform injector). Optionally, you can also + * override the injector configuration for an app by + * invoking `bootstrap` with the `componentInjectableBindings` argument. + * 3. It creates a new `Zone` and connects it to the angular application's change detection domain + * instance. + * 4. It creates a shadow DOM on the selected component's host element and loads the template into + * it. + * 5. It instantiates the specified component. + * 6. Finally, Angular performs change detection to apply the initial data bindings for the + * application. + * + * + * ## Instantiating Multiple Applications on a Single Page + * + * There are two ways to do this. + * + * + * ### Isolated Applications + * + * Angular creates a new application each time that the `bootstrap()` method is invoked. When + * multiple applications + * are created for a page, Angular treats each application as independent within an isolated change + * detection and + * `Zone` domain. If you need to share data between applications, use the strategy described in the + * next + * section, "Applications That Share Change Detection." + * + * + * ### Applications That Share Change Detection + * + * If you need to bootstrap multiple applications that share common data, the applications must + * share a common + * change detection and zone. To do that, create a meta-component that lists the application + * components in its template. + * By only invoking the `bootstrap()` method once, with the meta-component as its argument, you + * ensure that only a + * single change detection zone is created and therefore data can be shared across the applications. + * + * + * ## Platform Injector + * + * When working within a browser window, there are many singleton resources: cookies, title, + * location, and others. + * Angular services that represent these resources must likewise be shared across all Angular + * applications that + * occupy the same browser window. For this reason, Angular creates exactly one global platform + * injector which stores + * all shared services, and each angular application injector has the platform injector as its + * parent. + * + * Each application has its own private injector as well. When there are multiple applications on a + * page, Angular treats + * each application injector's services as private to that application. + * + * + * # API + * - `appComponentType`: The root component which should act as the application. This is a reference + * to a `Type` + * which is annotated with `@Component(...)`. + * - `componentInjectableBindings`: An additional set of bindings that can be added to the app + * injector + * to override default injection behavior. + * - `errorReporter`: `function(exception:any, stackTrace:string)` a default error reporter for + * unhandled exceptions. + * + * Returns a `Promise` of {@link ApplicationRef}. + */ + function bootstrap(appComponentType: /*Type*/ any, componentInjectableBindings?: Array) : Promise ; + + + /** + * Declare reusable UI building blocks for an application. + * + * Each Angular component requires a single `@Component` and at least one `@View` annotation. The + * `@Component` + * annotation specifies when a component is instantiated, and which properties and hostListeners it + * binds to. + * + * When a component is instantiated, Angular + * - creates a shadow DOM for the component. + * - loads the selected template into the shadow DOM. + * - creates all the injectable objects configured with `bindings` and `viewBindings`. + * + * All template expressions and statements are then evaluated against the component instance. + * + * For details on the `@View` annotation, see {@link ViewMetadata}. + * + * ## Example + * + * ``` + * @Component({ + * selector: 'greet' + * }) + * @View({ + * template: 'Hello {{name}}!' + * }) + * class Greet { + * name: string; + * + * constructor() { + * this.name = 'World'; + * } + * } + * ``` + */ + class ComponentMetadata extends DirectiveMetadata { + + + /** + * Defines the used change detection strategy. + * + * When a component is instantiated, Angular creates a change detector, which is responsible for + * propagating the component's bindings. + * + * The `changeDetection` property defines, whether the change detection will be checked every time + * or only when the component tells it to do so. + */ + changeDetection: ChangeDetectionStrategy; + + + /** + * Defines the set of injectable objects that are visible to its view dom children. + * + * ## Simple Example + * + * Here is an example of a class that can be injected: + * + * ``` + * class Greeter { + * greet(name:string) { + * return 'Hello ' + name + '!'; + * } + * } + * + * @Directive({ + * selector: 'needs-greeter' + * }) + * class NeedsGreeter { + * greeter:Greeter; + * + * constructor(greeter:Greeter) { + * this.greeter = greeter; + * } + * } + * + * @Component({ + * selector: 'greet', + * viewBindings: [ + * Greeter + * ] + * }) + * @View({ + * template: ``, + * directives: [NeedsGreeter] + * }) + * class HelloWorld { + * } + * + * ``` + */ + viewBindings: any[]; + } + + + /** + * Directives allow you to attach behavior to elements in the DOM. + * + * {@link DirectiveMetadata}s with an embedded view are called {@link ComponentMetadata}s. + * + * A directive consists of a single directive annotation and a controller class. When the + * directive's `selector` matches + * elements in the DOM, the following steps occur: + * + * 1. For each directive, the `ElementInjector` attempts to resolve the directive's constructor + * arguments. + * 2. Angular instantiates directives for each matched element using `ElementInjector` in a + * depth-first order, + * as declared in the HTML. + * + * ## Understanding How Injection Works + * + * There are three stages of injection resolution. + * - *Pre-existing Injectors*: + * - The terminal {@link Injector} cannot resolve dependencies. It either throws an error or, if + * the dependency was + * specified as `@Optional`, returns `null`. + * - The platform injector resolves browser singleton resources, such as: cookies, title, + * location, and others. + * - *Component Injectors*: Each component instance has its own {@link Injector}, and they follow + * the same parent-child hierarchy + * as the component instances in the DOM. + * - *Element Injectors*: Each component instance has a Shadow DOM. Within the Shadow DOM each + * element has an `ElementInjector` + * which follow the same parent-child hierarchy as the DOM elements themselves. + * + * When a template is instantiated, it also must instantiate the corresponding directives in a + * depth-first order. The + * current `ElementInjector` resolves the constructor dependencies for each directive. + * + * Angular then resolves dependencies as follows, according to the order in which they appear in the + * {@link ViewMetadata}: + * + * 1. Dependencies on the current element + * 2. Dependencies on element injectors and their parents until it encounters a Shadow DOM boundary + * 3. Dependencies on component injectors and their parents until it encounters the root component + * 4. Dependencies on pre-existing injectors + * + * + * The `ElementInjector` can inject other directives, element-specific special objects, or it can + * delegate to the parent + * injector. + * + * To inject other directives, declare the constructor parameter as: + * - `directive:DirectiveType`: a directive on the current element only + * - `@Host() directive:DirectiveType`: any directive that matches the type between the current + * element and the + * Shadow DOM root. + * - `@Query(DirectiveType) query:QueryList`: A live collection of direct child + * directives. + * - `@QueryDescendants(DirectiveType) query:QueryList`: A live collection of any + * child directives. + * + * To inject element-specific special objects, declare the constructor parameter as: + * - `element: ElementRef` to obtain a reference to logical element in the view. + * - `viewContainer: ViewContainerRef` to control child template instantiation, for + * {@link DirectiveMetadata} directives only + * - `bindingPropagation: BindingPropagation` to control change detection in a more granular way. + * + * ## Example + * + * The following example demonstrates how dependency injection resolves constructor arguments in + * practice. + * + * + * Assume this HTML template: + * + * ``` + *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * ``` + * + * With the following `dependency` decorator and `SomeService` injectable class. + * + * ``` + * @Injectable() + * class SomeService { + * } + * + * @Directive({ + * selector: '[dependency]', + * properties: [ + * 'id: dependency' + * ] + * }) + * class Dependency { + * id:string; + * } + * ``` + * + * Let's step through the different ways in which `MyDirective` could be declared... + * + * + * ### No injection + * + * Here the constructor is declared with no arguments, therefore nothing is injected into + * `MyDirective`. + * + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor() { + * } + * } + * ``` + * + * This directive would be instantiated with no dependencies. + * + * + * ### Component-level injection + * + * Directives can inject any injectable instance from the closest component injector or any of its + * parents. + * + * Here, the constructor declares a parameter, `someService`, and injects the `SomeService` type + * from the parent + * component's injector. + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(someService: SomeService) { + * } + * } + * ``` + * + * This directive would be instantiated with a dependency on `SomeService`. + * + * + * ### Injecting a directive from the current element + * + * Directives can inject other directives declared on the current element. + * + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(dependency: Dependency) { + * expect(dependency.id).toEqual(3); + * } + * } + * ``` + * This directive would be instantiated with `Dependency` declared at the same element, in this case + * `dependency="3"`. + * + * ### Injecting a directive from any ancestor elements + * + * Directives can inject other directives declared on any ancestor element (in the current Shadow + * DOM), i.e. on the current element, the + * parent element, or its parents. + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(@Host() dependency: Dependency) { + * expect(dependency.id).toEqual(2); + * } + * } + * ``` + * + * `@Host` checks the current element, the parent, as well as its parents recursively. If + * `dependency="2"` didn't + * exist on the direct parent, this injection would + * have returned + * `dependency="1"`. + * + * + * ### Injecting a live collection of direct child directives + * + * + * A directive can also query for other child directives. Since parent directives are instantiated + * before child directives, a directive can't simply inject the list of child directives. Instead, + * the directive injects a {@link QueryList}, which updates its contents as children are added, + * removed, or moved by a directive that uses a {@link ViewContainerRef} such as a `ng-for`, an + * `ng-if`, or an `ng-switch`. + * + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(@Query(Dependency) dependencies:QueryList) { + * } + * } + * ``` + * + * This directive would be instantiated with a {@link QueryList} which contains `Dependency` 4 and + * 6. Here, `Dependency` 5 would not be included, because it is not a direct child. + * + * ### Injecting a live collection of descendant directives + * + * By passing the descendant flag to `@Query` above, we can include the children of the child + * elements. + * + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(@Query(Dependency, {descendants: true}) dependencies:QueryList) { + * } + * } + * ``` + * + * This directive would be instantiated with a Query which would contain `Dependency` 4, 5 and 6. + * + * ### Optional injection + * + * The normal behavior of directives is to return an error when a specified dependency cannot be + * resolved. If you + * would like to inject `null` on unresolved dependency instead, you can annotate that dependency + * with `@Optional()`. + * This explicitly permits the author of a template to treat some of the surrounding directives as + * optional. + * + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(@Optional() dependency:Dependency) { + * } + * } + * ``` + * + * This directive would be instantiated with a `Dependency` directive found on the current element. + * If none can be + * found, the injector supplies `null` instead of throwing an error. + * + * ## Example + * + * Here we use a decorator directive to simply define basic tool-tip behavior. + * + * ``` + * @Directive({ + * selector: '[tooltip]', + * properties: [ + * 'text: tooltip' + * ], + * host: { + * '(mouseenter)': 'onMouseEnter()', + * '(mouseleave)': 'onMouseLeave()' + * } + * }) + * class Tooltip{ + * text:string; + * overlay:Overlay; // NOT YET IMPLEMENTED + * overlayManager:OverlayManager; // NOT YET IMPLEMENTED + * + * constructor(overlayManager:OverlayManager) { + * this.overlay = overlay; + * } + * + * onMouseEnter() { + * // exact signature to be determined + * this.overlay = this.overlayManager.open(text, ...); + * } + * + * onMouseLeave() { + * this.overlay.close(); + * this.overlay = null; + * } + * } + * ``` + * In our HTML template, we can then add this behavior to a `
` or any other element with the + * `tooltip` selector, + * like so: + * + * ``` + *
+ * ``` + * + * Directives can also control the instantiation, destruction, and positioning of inline template + * elements: + * + * A directive uses a {@link ViewContainerRef} to instantiate, insert, move, and destroy views at + * runtime. + * The {@link ViewContainerRef} is created as a result of `