From 76ea613b90f40db3afae3ff77c21298d13775257 Mon Sep 17 00:00:00 2001 From: Gabriel Garcia Date: Mon, 20 Jul 2015 18:49:06 -0400 Subject: [PATCH 001/329] 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/329] 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/329] 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/329] 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 39c95a0a56c3ccb7f29a91797099c48e61ba5388 Mon Sep 17 00:00:00 2001 From: MugeSo Date: Thu, 20 Aug 2015 10:43:39 +0900 Subject: [PATCH 005/329] 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 006/329] 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 007/329] 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 008/329] 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 009/329] 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 010/329] 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 011/329] 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 012/329] 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 013/329] 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 989e5e7ada29f8e9e36460bc528875f008893226 Mon Sep 17 00:00:00 2001 From: Calvin Fernandez Date: Thu, 27 Aug 2015 17:43:24 -0400 Subject: [PATCH 014/329] 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 a132dbfacf6491d421abb213e13cd1fd6f3c222b Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Sat, 29 Aug 2015 18:31:48 -0500 Subject: [PATCH 015/329] 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 a568ce93455b6fa6d7a229673bd37e801552ccb2 Mon Sep 17 00:00:00 2001 From: Artem Kozlov Date: Mon, 31 Aug 2015 10:42:56 +0200 Subject: [PATCH 016/329] 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 1a61d12d8d63514e1f1d3fcedf44b2384780c302 Mon Sep 17 00:00:00 2001 From: "Ciuca, Alexandru" Date: Thu, 3 Sep 2015 15:56:47 +0300 Subject: [PATCH 017/329] 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 0bc18bba93d7cb1601dab5a7e19b163a7b3bda41 Mon Sep 17 00:00:00 2001 From: Dan Lewi Harkestad Date: Fri, 4 Sep 2015 08:52:24 +0200 Subject: [PATCH 018/329] Fixed row getters in selection API. See: http://ui-grid.info/docs/#/api/ui.grid.selection.api:PublicApi getSelectedGridRows should return uiGrid.IGridRow, not the uiGrid.selection.IGridRow interface which only has the selection-specific properties. getSelectedRows returns the selected entities, not grid rows. --- ui-grid/ui-grid-tests.ts | 2 ++ ui-grid/ui-grid.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ui-grid/ui-grid-tests.ts b/ui-grid/ui-grid-tests.ts index 21d42c021..485f7d378 100644 --- a/ui-grid/ui-grid-tests.ts +++ b/ui-grid/ui-grid-tests.ts @@ -100,3 +100,5 @@ gridApi.core.queueGridRefresh() gridApi.core.queueRefresh(); gridApi.core.registerColumnsProcessor(colProcessor, 100); +var selectedRowEntities: Array = gridApi.selection.getSelectedRows(); +var selectedGridRows: Array = gridApi.selection.getSelectedGridRows(); diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 5f66eca1f..38a7aadbf 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 From 2e31771e4701df0cfefb3a17e18d0fdbe4cb5453 Mon Sep 17 00:00:00 2001 From: marcelk Date: Fri, 4 Sep 2015 14:48:14 +0200 Subject: [PATCH 019/329] Update Ui Router Extra's. Added deepstate redirect and extended stickystate. --- ui-router-extras/ui-router-extras-tests.ts | 35 +++++++-- ui-router-extras/ui-router-extras.d.ts | 86 +++++++++++++++++++--- 2 files changed, 107 insertions(+), 14 deletions(-) diff --git a/ui-router-extras/ui-router-extras-tests.ts b/ui-router-extras/ui-router-extras-tests.ts index 22d9e4f73..a87b95863 100644 --- a/ui-router-extras/ui-router-extras-tests.ts +++ b/ui-router-extras/ui-router-extras-tests.ts @@ -3,10 +3,24 @@ var myApp = angular.module('testModule') myApp.config(($stateProvider: angular.ui.IStateProvider, $stickyStateProvider: angular.ui.IStickyStateProvider) => { - var state: angular.ui.IStickyState = { + var state: angular.ui.IStickyState = { name: 'test', - sticky: true, - controller: ($previousState: angular.ui.IPreviousStateService) => { + sticky: true, + dsr: { + default: 'substate', + params: ['param1', 'param2'], + fn: function ($dsr$) { + + return $dsr$.to; + } + }, + onInactivate: function ($state: angular.ui.IState) { + var iAmInjectedByInjector = $state; + }, + onReactivate: function ($state: angular.ui.IState) { + var iAmInjectedByInjector = $state; + }, + controller: ($previousState: angular.ui.IPreviousStateService, $deepstateRedirect: angular.ui.IDeepStateRedirectService) => { $previousState.memo('test-memo1'); $previousState.memo('test-memo2', 'test-state-name2'); $previousState.memo('test-memo3', 'test-state-name3', {}); @@ -14,8 +28,19 @@ myApp.config(($stateProvider: angular.ui.IStateProvider, $stickyStateProvider: a $previousState.go('test-memo2', { location: true, notify: true - }); - } + }); + $previousState.get(); + $previousState.get('test-memo1'); + + $deepstateRedirect.reset('statename1', { + 'stateParam1': ['value1', 'value2'], + 'stateParam2': 'value' + }); + }, + views: { + //named views are mandatory + 'name1': {} + } }; $stickyStateProvider.enableDebug(true); diff --git a/ui-router-extras/ui-router-extras.d.ts b/ui-router-extras/ui-router-extras.d.ts index 8e0c42828..df0d0aa3e 100644 --- a/ui-router-extras/ui-router-extras.d.ts +++ b/ui-router-extras/ui-router-extras.d.ts @@ -1,6 +1,6 @@ // Type definitions for UI-Router Extras 0.0.14+ (ct.ui.router.extras module) // Project: https://github.com/christopherthielen/ui-router-extras -// Definitions by: Michael Putters +// Definitions by: Michael Putters , Marcel van de Kamp // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -13,12 +13,54 @@ declare module 'angular-ui-router-extras' { declare module angular.ui { - /** + + /* + * $deepStateRedirect + */ + interface IDeepStateRedirectService { + /* + * This method resets stored $deepStateRedirect data so following transitions will behave like there have not been previous transitions. + * @param stateParams Can be passed in to select specific states to reset: + * { + * 'paramName': 'paramvalue' | ['list', 'of', 'possible', 'paramvalues'] + * } + */ + reset(stateName: string, stateParams?: { [key: string]: string | string[] }): void; + } + + /* + * Docs: http://christopherthielen.github.io/ui-router-extras/#/dsr + */ + interface IDeepStateRedirectConfig { + /* + * If no deep state has been recorded, DSR will instead redirect to the default substate and params that you specify. + * If default is a string it is interpreted as the substate. + */ + default?: string | IRedirectParams; + /* + * Specify params: true if your DSR state takes parameters. + * If only a subset of the parameters should be included in the parameter grouping for recording deep states, + * specify an array of parameter names. + */ + params?: boolean | string[]; + /* + * A callback function that determines whether or not the redirect should actually occur, or changes the redirect to some other state. + * Return an object: IRedirectParams to change the redirect + */ + fn?($dsr$: { redirect: IRedirectParams; to: IRedirectParams }): boolean | IRedirectParams; + } + + interface IRedirectParams { + state: string; + params?: ui.IStateParamsService; + } + + /* * Previous state */ - interface IPreviousState { - state: IState; - params?: {}; + interface IPreviousState { + state: IState; + params?: ui.IStateParamsService; } /** @@ -54,16 +96,42 @@ declare module angular.ui { * @param memoName Memo name */ forget(memoName: string): void; - - } + } /** - * Sticky state - */ + * Sticky state + */ interface IStickyState extends angular.ui.IState { + /* + * When marking a state sticky, the state must target its own unique named ui-view. + * Docs: http://christopherthielen.github.io/ui-router-extras/#/sticky + */ sticky?: boolean; + /* + * The most-recently-activate substate of the DSR marked state is remembered. + * When the DSR marked state is transitioned to directly, UI-Router Extras will instead redirect to the remembered state and parameters. + * Docs: http://christopherthielen.github.io/ui-router-extras/#/dsr + */ + deepStateRedirect?: boolean | IDeepStateRedirectConfig; + /* + * Shortname deepStateRedirect prop + */ + dsr?: boolean | IDeepStateRedirectConfig; + /* + * Function (injectable). Called when a sticky state is navigated away from (inactivated). + */ + onInactivate?: Function; + /* + * Function (injectable). Called when an inactive sticky state is navigated to (reactivated). + */ + onReactivate?: Function; + /* + * Note: named views are mandatory when using sticky states! + */ + views?: {}; } + /** * Sticky state service */ From 037e1e8c614a80b903d555327e9f80f63c6f5a1c Mon Sep 17 00:00:00 2001 From: Sebastian Coetzee Date: Fri, 4 Sep 2015 16:49:08 +0200 Subject: [PATCH 020/329] Update mithril.d.ts Updates mithril typing definitions. Adds some API functionality that was not there previously. --- mithril/mithril.d.ts | 48 +++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/mithril/mithril.d.ts b/mithril/mithril.d.ts index e01dbcc02..3cd0e21e4 100644 --- a/mithril/mithril.d.ts +++ b/mithril/mithril.d.ts @@ -8,19 +8,15 @@ interface MithrilStatic { (selector: string, attributes: Object, children?: any): MithrilVirtualElement; (selector: string, children?: any): MithrilVirtualElement; - prop(value?: T): (value?: T) => T; - prop(promise: MithrilPromise): MithrilPromiseProperty; + prop(value?: T): (value?: T) => T; + prop(promise: MithrilPromise): MithrilPromiseProperty; withAttr(property: string, callback: (value: any) => void): (e: Event) => any; module(rootElement: Node, module: MithrilModule): void; trust(html: string): String; render(rootElement: Element, children?: any): void; render(rootElement: HTMLDocument, children?: any): void; redraw: MithrilRedraw; - route(rootElement: Element, defaultRoute: string, routes: { [key: string]: MithrilModule }): void; - route(rootElement: HTMLDocument, defaultRoute: string, routes: { [key: string]: MithrilModule }): void; - route(path: string, params?: any, shouldReplaceHistory?: boolean): void; - route(): string; - route(element: Element, isInitialized: boolean): void; + route: MithrilRoute; request(options: MithrilXHROptions): MithrilPromise; deferred(): MithrilDeferred; sync(promises: MithrilPromise[]): MithrilPromise; @@ -28,6 +24,22 @@ interface MithrilStatic { endComputation(): void; } +interface MithrilRoute { + (rootElement: Element, defaultRoute: string, routes: { [key: string]: MithrilModule }): void; + (rootElement: HTMLDocument, defaultRoute: string, routes: { [key: string]: MithrilModule }): void; + (path: string, params?: any, shouldReplaceHistory?: boolean): void; + (element: Element, isInitialized: boolean): void; + (): string; + mode: string; + param: MithrilParam; + buildQueryString(data: Object): string; + parseQueryString(queryString: string): Object; +} + +interface MithrilParam { + (param: string): string; +} + interface MithrilRedraw { (): void; strategy: (value?: string) => string; @@ -40,26 +52,26 @@ interface MithrilVirtualElement { } interface MithrilModule { - controller: Function; - view: (controller?: any) => MithrilVirtualElement; + controller: Function; + view: (controller?: any) => MithrilVirtualElement; } interface MithrilDeferred { - resolve(value?: T): void; - reject(value?: any): void; - promise: MithrilPromise; + resolve(value?: T): void; + reject(value?: any): void; + promise: MithrilPromise; } interface MithrilPromise { - (value?: T): T; - then(successCallback?: (value: T) => R, errorCallback?: (value: any) => any): MithrilPromise; - then(successCallback?: (value: T) => MithrilPromise, errorCallback?: (value: any) => any): MithrilPromise; + (value?: T): T; + then(successCallback?: (value: T) => R, errorCallback?: (value: any) => any): MithrilPromise; + then(successCallback?: (value: T) => MithrilPromise, errorCallback?: (value: any) => any): MithrilPromise; } interface MithrilPromiseProperty extends MithrilPromise { - (): T; - (value: T): T; - toJSON(): T; + (): T; + (value: T): T; + toJSON(): T; } interface MithrilXHROptions { From 90e1dab8cd073844547e77ff41eb37a13ca97d11 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 6 Sep 2015 14:29:02 -0400 Subject: [PATCH 021/329] Updated for version 1.4.1, jsdoc documentaiton Updated jquery.cookie.d.ts to conform to the latest version of jquery.cookie (1.4.1). This meant adding a defaults property to the JQueryCookieStatic interface. Also added missing jsdoc documentation for better intellisense for editors that support it. The documentation uses the Github repo documentation where possible. --- jquery.cookie/jquery.cookie.d.ts | 84 +++++++++++++++++++++++++++++--- 1 file changed, 78 insertions(+), 6 deletions(-) diff --git a/jquery.cookie/jquery.cookie.d.ts b/jquery.cookie/jquery.cookie.d.ts index 06380f999..be88ca363 100644 --- a/jquery.cookie/jquery.cookie.d.ts +++ b/jquery.cookie/jquery.cookie.d.ts @@ -1,34 +1,106 @@ -// Type definitions for jQuery Cookie Plugin 1.3 +// Type definitions for jQuery Cookie Plugin 1.4.1 // Project: https://github.com/carhartl/jquery-cookie -// Definitions by: Roy Goode +// Definitions by: Roy Goode , Ben Lorantfy // Definitions: https://github.com/borisyankov/DefinitelyTyped /// interface JQueryCookieOptions { + /** + * Define lifetime of the cookie. Value can be a Number which will be interpreted as days from time of creation or a Date object. If omitted, the cookie becomes a session cookie. + */ expires?: any; + /** + * Define the path where the cookie is valid. By default the path of the cookie is the path of the page where the cookie was created (standard browser behavior). If you want to make it available for instance across the entire domain use path: '/'. Default: path of page where the cookie was created. + */ path?: string; + /** + * Define the domain where the cookie is valid. Default: domain of page where the cookie was created. + */ domain?: string; + /** + * If true, the cookie transmission requires a secure protocol (https). Default: false. + */ secure?: boolean; } - +// +// The following jsdoc comments are used to add intellisense to editors that support it. Uses snippets +// of documentation from the Github repo when possible. +// +// The ordering here matters. For example, the read function with the converter parameter is purposefully after +// the set function. This is because the intellisense that shows up after you press comma should be the set first, +// since that is more common, then the conversion function if user starts typing a parameter with a function type interface JQueryCookieStatic { + /** + * By default the cookie value is encoded/decoded when writing/reading, using encodeURIComponent/decodeURIComponent. Bypass this by setting raw to true: + */ raw?: boolean; + /** + * Turn on automatic storage of JSON objects passed as the cookie value. Assumes JSON.stringify and JSON.parse + */ json?: boolean; - + /** + * Cookie attributes can be set globally by setting properties of the $.cookie.defaults object or individually for each call to $.cookie() by passing a plain object to the options argument. Per-call options override the default options. + */ + defaults?: JQueryCookieOptions; + /** + * Gets an object of cookies as key-value pairs + */ (): {[key:string]:string}; + /** + * Gets a cookie by name + * @param name The name of the cookie to get + */ (name: string): any; - (name: string, converter: (value: string) => any): any; + /** + * Sets a cookie + * @param name The name of the cookie to set + * @param value The value to set the cookie to + */ (name: string, value: string): void; + /** + * Gets a cookie by name after applying a conversion function to the value + * @param name The name of the cookie to get + * @param converter A conversion function to change the cookie's value to a different representation on the fly + */ + (name: string, converter: (value: string) => any): any; + /** + * Sets a cookie with some options + * @param name The name of the cookie to set + * @param value The value to set the cookie to + * @param options An object of options that change how the cookie is set + */ (name: string, value: string, options: JQueryCookieOptions): void; + /** + * Sets a cookie using .toString(), or if $.cookie.json is set to true using JSON.stringify() + * @param name The name of the cookie to set + * @param value The value to set the cookie to + */ (name: string, value: any): void; + /** + * Sets a cookie using .toString(), or if $.cookie.json is set to true using JSON.stringify() + * @param name The name of the cookie to set + * @param value The value to set the cookie to + * @param options An object of options that change how the cookie is set + */ (name: string, value: any, options: JQueryCookieOptions): void; } interface JQueryStatic { + /** + * A simple, lightweight jQuery plugin for reading, writing and deleting cookies. + */ cookie?: JQueryCookieStatic; - + /** + * Deletes a cookie + * @param name Name of cookie to delete + */ removeCookie(name: string): boolean; + /** + * Deletes a cookie + * @param name Name of cookie to delete + * @param options The same attributes (path, domain) as what the cookie was written with + */ removeCookie(name: string, options: JQueryCookieOptions): boolean; } From d2bf7eed77d8704ca03555d0b60071bb3ae0d7ee Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 6 Sep 2015 14:33:02 -0400 Subject: [PATCH 022/329] Updated to test new defaults property --- jquery.cookie/jquery.cookie-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jquery.cookie/jquery.cookie-tests.ts b/jquery.cookie/jquery.cookie-tests.ts index 69a8c0412..ab9b8cb5a 100644 --- a/jquery.cookie/jquery.cookie-tests.ts +++ b/jquery.cookie/jquery.cookie-tests.ts @@ -35,3 +35,5 @@ $.cookie("test", testObject, cookieOptions); var result = $.cookie("test"); console.log(result.text); + +$.cookie.defaults = cookieOptions; From de418bbbb42567d24f8b26a390bb9a9dbb711084 Mon Sep 17 00:00:00 2001 From: Dan Lewi Harkestad Date: Mon, 7 Sep 2015 14:34:51 +0200 Subject: [PATCH 023/329] GridInstance.scrollTo takes an object in the data array as parameter, not a GridRow. Also, both parameters are optional. See https://github.com/angular-ui/ui-grid/blob/a42dab24532fb896725b9fc8359e4526e436c891/src/js/core/factories/Grid.js#L2419-L2440 --- ui-grid/ui-grid-tests.ts | 6 ++++++ ui-grid/ui-grid.d.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ui-grid/ui-grid-tests.ts b/ui-grid/ui-grid-tests.ts index 485f7d378..4eedf8675 100644 --- a/ui-grid/ui-grid-tests.ts +++ b/ui-grid/ui-grid-tests.ts @@ -100,5 +100,11 @@ gridApi.core.queueGridRefresh() gridApi.core.queueRefresh(); gridApi.core.registerColumnsProcessor(colProcessor, 100); +var rowEntityToScrollTo = {anObject: "inGridOptionsData"}; +var columnDefToScrollTo: uiGrid.IColumnDef; +gridInstance.scrollTo(); +gridInstance.scrollTo(rowEntityToScrollTo); +gridInstance.scrollTo(rowEntityToScrollTo, columnDefToScrollTo); + var selectedRowEntities: Array = gridApi.selection.getSelectedRows(); var selectedGridRows: Array = gridApi.selection.getSelectedGridRows(); diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 38a7aadbf..f9371fc5c 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -445,7 +445,7 @@ declare module uiGrid { * @param {IColumnDef} colDef to make visible * @returns {ng.IPromise} a promise that is resolved after any scrolling is finished */ - scrollTo(rowEntity: IGridRow, colDef: IColumnDef): ng.IPromise; + scrollTo(rowEntity?: any, colDef?: IColumnDef): ng.IPromise; /** * Scrolls the grid to make a certain row and column combo visible, * in the case that it is not completely visible on the screen already. From 925549c4eb5078662fff90d6d20b586118b09ed2 Mon Sep 17 00:00:00 2001 From: pallxk Date: Mon, 7 Sep 2015 21:06:54 +0800 Subject: [PATCH 024/329] underscore: remove method 'value' from interface 'UnderscoreStatic' --- underscore/underscore.d.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 1f8faf2e2..7dea66a84 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -1614,13 +1614,6 @@ interface UnderscoreStatic { **/ chain(obj: T[]): _Chain; chain(obj: T): _Chain; - - /** - * Extracts the value of a wrapped object. - * @param obj Wrapped object to extract the value from. - * @return Value of `obj`. - **/ - value(obj: T): TResult; } interface Underscore { @@ -2463,7 +2456,8 @@ interface Underscore { /** * Wrapped type `any`. - * @see _.value + * Extracts the value of a wrapped object. + * @return Value of the wrapped object. **/ value(): TResult; } From 1e55782c9d47d996ab5c88988062020ce894e57b Mon Sep 17 00:00:00 2001 From: Sebastian Lenz Date: Mon, 7 Sep 2015 15:53:42 +0200 Subject: [PATCH 025/329] Add node-progress definition --- node-progress/node-progress.d.ts | 121 +++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 node-progress/node-progress.d.ts diff --git a/node-progress/node-progress.d.ts b/node-progress/node-progress.d.ts new file mode 100644 index 000000000..2c7e683ec --- /dev/null +++ b/node-progress/node-progress.d.ts @@ -0,0 +1,121 @@ +// Type definitions for node-progress v1.1.8 +// Project: https://github.com/tj/node-progress +// Definitions by: Sebastian Lenz +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + + +declare module "progress" +{ + /** + * These are keys in the options object you can pass to the progress bar along with total as seen in the example above. + */ + interface ProgressBarOptions + { + /** + * Total number of ticks to complete. + */ + total:number; + + /** + * The displayed width of the progress bar defaulting to total. + */ + width?:number; + + /** + * The output stream defaulting to stderr. + */ + stream?:NodeJS.WritableStream; + + /** + * Completion character defaulting to "=". + */ + complete?:string; + + /** + * Incomplete character defaulting to "-". + */ + incomplete?:string; + + /** + * Option to clear the bar on completion defaulting to false. + */ + clear?:boolean; + + /** + * Optional function to call when the progress bar completes. + */ + callback?:Function; + } + + + /** + * Flexible ascii progress bar. + */ + class ProgressBar + { + /** + * Initialize a `ProgressBar` with the given `fmt` string and `options` or + * `total`. + * + * Options: + * - `total` total number of ticks to complete + * - `width` the displayed width of the progress bar defaulting to total + * - `stream` the output stream defaulting to stderr + * - `complete` completion character defaulting to "=" + * - `incomplete` incomplete character defaulting to "-" + * - `renderThrottle` minimum time between updates in milliseconds defaulting to 16 + * - `callback` optional function to call when the progress bar completes + * - `clear` will clear the progress bar upon termination + * + * Tokens: + * - `:bar` the progress bar itself + * - `:current` current tick number + * - `:total` total ticks + * - `:elapsed` time elapsed in seconds + * - `:percent` completion percentage + * - `:eta` eta in seconds + */ + constructor(format:string, total:number); + constructor(format:string, options:ProgressBarOptions); + + + /** + * "tick" the progress bar with optional `len` and optional `tokens`. + */ + tick(tokens?:any):void; + tick(count?:number, tokens?:any):void; + + + /** + * Method to render the progress bar with optional `tokens` to place in the + * progress bar's `fmt` field. + */ + render(tokens?:any):void; + + + /** + * "update" the progress bar to represent an exact percentage. + * The ratio (between 0 and 1) specified will be multiplied by `total` and + * floored, representing the closest available "tick." For example, if a + * progress bar has a length of 3 and `update(0.5)` is called, the progress + * will be set to 1. + * + * A ratio of 0.5 will attempt to set the progress to halfway. + * + * @param ratio The ratio (between 0 and 1 inclusive) to set the + * overall completion to. + */ + update(ratio:number, tokens?:any):void; + + + /** + * Terminates a progress bar. + */ + terminate():void; + } + + + export = ProgressBar; +} From 2cdbc68f690138410785db1cb4fcbd64e36e4203 Mon Sep 17 00:00:00 2001 From: Sebastian Lenz Date: Mon, 7 Sep 2015 15:54:34 +0200 Subject: [PATCH 026/329] Add test case for node-progress --- node-progress/node-progress-test.ts | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 node-progress/node-progress-test.ts diff --git a/node-progress/node-progress-test.ts b/node-progress/node-progress-test.ts new file mode 100644 index 000000000..1e723aabe --- /dev/null +++ b/node-progress/node-progress-test.ts @@ -0,0 +1,32 @@ +/// + +var ProgressBar = require('progress'); + + +/** + * Usage example from https://github.com/tj/node-progress + */ +var bar = new ProgressBar(':bar', { total: 10 }); +var timer = setInterval(function () { + bar.tick(); + if (bar.complete) { + console.log('\ncomplete\n'); + clearInterval(timer); + } +}, 100); + + +/** + * Custom token example from https://github.com/tj/node-progress + */ +var bar = new ProgressBar(':current: :token1 :token2', { total: 3 }); + +bar.tick({ + 'token1': "Hello", + 'token2': "World!\n" +}); + +bar.tick(2, { + 'token1': "Goodbye", + 'token2': "World!" +}); From 223d643b9225cff5a876f12daa4598785cf5b239 Mon Sep 17 00:00:00 2001 From: laurentiustamate94 Date: Tue, 8 Sep 2015 07:09:02 +0300 Subject: [PATCH 027/329] Added amplify with JQuery Deferred support --- amplify-deferred/amplify-deferred-tests.ts | 265 ++++++++++++++++++ .../amplify-deferred-tests.ts.tscparams | 1 + amplify-deferred/amplify-deferred.d.ts | 182 ++++++++++++ 3 files changed, 448 insertions(+) create mode 100644 amplify-deferred/amplify-deferred-tests.ts create mode 100644 amplify-deferred/amplify-deferred-tests.ts.tscparams create mode 100644 amplify-deferred/amplify-deferred.d.ts diff --git a/amplify-deferred/amplify-deferred-tests.ts b/amplify-deferred/amplify-deferred-tests.ts new file mode 100644 index 000000000..957941cd2 --- /dev/null +++ b/amplify-deferred/amplify-deferred-tests.ts @@ -0,0 +1,265 @@ +/// +/// + +// Copied examples directly from AmplifyJs site + +// Subscribe and publish with no data + +amplify.subscribe("nodataexample", function () { + alert("nodataexample topic published!"); +}); + +// Subscribe and publish with data + +amplify.publish("nodataexample"); + +amplify.subscribe("dataexample", function (data) { + alert(data.foo); // bar +}); + + +amplify.publish("dataexample", { foo: "bar" }); + +amplify.subscribe("dataexample2", function (param1, param2) { + alert(param1 + param2); // barbaz +}); + +//... + +amplify.publish("dataexample2", "bar", "baz"); + +// Subscribe and publish with context and data + +amplify.subscribe("datacontextexample", $("p:first"), function (data) { + this.text(data.exampleText); // first p element would have "foo bar baz" as text +}); + +amplify.publish("datacontextexample", { exampleText: "foo bar baz" }); + +// Subscribe to a topic with high priority + +amplify.subscribe("priorityexample", function (data) { + alert(data.foo); +}); + +amplify.subscribe("priorityexample", function (data) { + if (data.foo === "oops") { + return false; + } +}, 1); + + +// Store data with amplify storage picking the default storage technology: + +amplify.publish("priorityexample", { foo: "bar" }); +amplify.publish("priorityexample", { foo: "oops" }); + +amplify.store("storeExample1", { foo: "bar" }); +amplify.store("storeExample2", "baz"); +// retrieve the data later via the key +var myStoredValue = amplify.store("storeExample1"), + myStoredValue2 = amplify.store("storeExample2"), + myStoredValues = amplify.store(); +myStoredValue.foo; // bar +myStoredValue2; // baz +myStoredValues.storeExample1.foo; // bar +myStoredValues.storeExample2; // baz + +// Store data explicitly with session storage + +amplify.store.sessionStorage("explicitExample", { foo2: "baz" }); +// retrieve the data later via the key +var myStoredValue2 = amplify.store.sessionStorage("explicitExample"); +myStoredValue2.foo2; // baz + + +// REQUEST + +// Set up and use a request utilizing Ajax + + +amplify.request.define("ajaxExample1", "ajax", { + url: "/myApiUrl", + dataType: "json", + type: "GET" +}); + +// later in code +amplify.request("ajaxExample1", function (data) { + data.foo; // bar +}); + +// Set up and use a request utilizing Ajax and Caching + +amplify.request.define("ajaxExample2", "ajax", { + url: "/myApiUrl", + dataType: "json", + type: "GET", + cache: "persist" +}); + +// later in code +amplify.request("ajaxExample2", function (data) { + data.foo; // bar +}); + +// a second call will result in pulling from the cache +amplify.request("ajaxExample2", function (data) { + data.baz; // qux +}) + +// Set up and use a RESTful request utilizing Ajax + +amplify.request.define("ajaxRESTFulExample", "ajax", { + url: "/myRestFulApi/{type}/{id}", + type: "GET" +}) + +// later in code +amplify.request("ajaxRESTFulExample", + { + type: "foo", + id: "bar" + }, + function (data) { + // /myRESTFulApi/foo/bar was the URL used + data.foo; // bar + } + ); + +// POST data with Ajax + +amplify.request.define("ajaxPostExample", "ajax", { + url: "/myRestFulApi", + type: "POST" +}) + +// later in code +amplify.request("ajaxPostExample", + { + type: "foo", + id: "bar" + }, + function (data) { + data.foo; // bar + } + ); +// Using data maps + +// When searching Twitter, the key for the search phrase is q.If we want a more descriptive name, such as term, we can use a data map: + +amplify.request.define("twitter-search", "ajax", { + url: "http://search.twitter.com/search.json", + dataType: "jsonp", + dataMap: { + term: "q" + } +}); + +amplify.request("twitter-search", { term: "amplifyjs" }); + +// Similarly, we can create a request that searches for mentions, by accepting a username: + +amplify.request.define("twitter-mentions", "ajax", { + url: "http://search.twitter.com/search.json", + dataType: "jsonp", + dataMap: function (data) { + return { + q: "@" + data.user + }; + } +}); + +amplify.request("twitter-mentions", { user: "amplifyjs" }); + +// Setting up and using decoders + +//Example: + +var appEnvelopeDecoder: amplifyDecoder = function (data, status, xhr, success, error) { + if (data.status === "success") { + success(data.data); + } else if (data.status === "fail" || data.status === "error") { + error(data.message, data.status); + } else { + error(data.message, "fatal"); + } +}; + +//a new decoder can be added to the amplifyDecoders interface +interface amplifyDecoders { + appEnvelope: amplifyDecoder; +} + +amplify.request.decoders.appEnvelope = appEnvelopeDecoder; + +//but you can also just add it via an index +amplify.request.decoders['appEnvelopeStr'] = appEnvelopeDecoder; + + +amplify.request.define("decoderExample", "ajax", { + url: "/myAjaxUrl", + type: "POST", + decoder: "appEnvelope" +}); + +amplify.request({ + resourceId: "decoderExample", + success: function (data) { + data.foo; // bar + }, + error: function (message, level) { + alert("always handle errors with alerts."); + } +}); + +// POST with caching and single - use decoder + +// Example: + +amplify.request.define("decoderSingleExample", "ajax", { + url: "/myAjaxUrl", + type: "POST", + decoder: function (data, status, xhr, success, error) { + if (data.status === "success") { + success(data.data); + } else if (data.status === "fail" || data.status === "error") { + error(data.message, data.status); + } else { + error(data.message, "fatal"); + } + } +}); + +amplify.request({ + resourceId: "decoderSingleExample", + success: function (data) { + data.foo; // bar + }, + error: function (message, level) { + alert("always handle errors with alerts."); + } +}); +// Handling Status +// Status in Success and Error Callbacks + +// amplify.request comes with built in support for status.The status parameter appears in the default success or error callbacks when using an ajax definition. + +amplify.request.define("statusExample1", "ajax", { + //... +}); + +amplify.request({ + resourceId: "statusExample1", + success: function (data, status) { + }, + error: function (data, status) { + } +}); + +amplify.request({ + resourceId: "statusExample1" +}).done(function (data, status) { +}).fail(function (data, status) { +}).always(function (data, status) { }); + diff --git a/amplify-deferred/amplify-deferred-tests.ts.tscparams b/amplify-deferred/amplify-deferred-tests.ts.tscparams new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/amplify-deferred/amplify-deferred-tests.ts.tscparams @@ -0,0 +1 @@ + diff --git a/amplify-deferred/amplify-deferred.d.ts b/amplify-deferred/amplify-deferred.d.ts new file mode 100644 index 000000000..11e6d05e0 --- /dev/null +++ b/amplify-deferred/amplify-deferred.d.ts @@ -0,0 +1,182 @@ +// Type definitions for AmplifyJs 1.1.0 using JQuery Deferred +// Project: http://amplifyjs.com/ +// Definitions by: Jonas Eriksson , Laurentiu Stamate +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface amplifyRequestSettings { + resourceId: string; + data?: any; + success?: (...args: any[]) => void; + error?: (...args: any[]) => void; +} + +interface amplifyDecoder { + ( + data?: any, + status?: string, + xhr?: JQueryXHR, + success?: (...args: any[]) => void, + error?: (...args: any[]) => void + ): void +} + +interface amplifyDecoders { + [decoderName: string]: amplifyDecoder; + jsSend: amplifyDecoder; +} + +interface amplifyAjaxSettings extends JQueryAjaxSettings { + cache?: any; + dataMap?: {} | ((data: any) => {}); + decoder?: any /* string or amplifyDecoder */; +} + +interface amplifyRequest { + + /*** + * Request a resource. + * resourceId: Identifier string for the resource. + * data: A set of key/value pairs of data to be sent to the resource. + * callback: A function to invoke if the resource is retrieved successfully. + */ + (resourceId: string, hash?: any, callback?: Function): JQueryPromise; + + /*** + * Request a resource. + * settings: A set of key/value pairs of settings for the request. + * resourceId: Identifier string for the resource. + * data (optional): Data associated with the request. + * success (optional): Function to invoke on success. + * error (optional): Function to invoke on error. + */ + (settings: amplifyRequestSettings): JQueryPromise; + + /*** + * Define a resource. + * resourceId: Identifier string for the resource. + * requestType: The type of data retrieval method from the server. See the request types sections for more information. + * settings: A set of key/value pairs that relate to the server communication technology. The following settings are available: + * Any settings found in jQuery.ajax(). + * cache: See the cache section for more details. + * decoder: See the decoder section for more details. + */ + define(resourceId: string, requestType: string, settings?: amplifyAjaxSettings): void; + + /*** + * Define a custom request. + * resourceId: Identifier string for the resource. + * resource: Function to handle requests. Receives a hash with the following properties: + * resourceId: Identifier string for the resource. + * data: Data provided by the user. + * success: Callback to invoke on success. + * error: Callback to invoke on error. + */ + define(resourceId: string, resource: (settings: amplifyRequestSettings) => void): void; + + decoders: amplifyDecoders; + cache: any; +} + +interface amplifySubscribe { + /*** + * Subscribe to a message. + * topic: Name of the message to subscribe to. + * callback: Function to invoke when the message is published. + */ + (topic: string, callback: Function): void; + /*** + * Subscribe to a message. + * topic: Name of the message to subscribe to. + * context: What this will be when the callback is invoked. + * callback: Function to invoke when the message is published. + * [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10. + */ + (topic: string, context: any, callback: Function, priority?: number): void; + /*** + * Subscribe to a message. + * topic: Name of the message to subscribe to. + * callback: Function to invoke when the message is published. + * [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10. + */ + (topic: string, callback: Function, priority?: number): void; +} +interface amplifyStorageTypeStore { + /*** + * Stores a value for a given key using the default storage type. + * + * key: Identifier for the value being stored. + * value: The value to store. The value can be anything that can be serialized as JSON. + * [options]: A set of key/value pairs that relate to settings for storing the value. + */ + (key: string, value: any, options?: any): void; + + /*** + * Gets a stored value based on the key. + */ + (key: string): any; + + /*** + * Gets a hash of all stored values. + */ + (): any; +} + +interface amplifyStore extends amplifyStorageTypeStore { + + /*** + * IE 8+, Firefox 3.5+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+ + */ + localStorage: amplifyStorageTypeStore; + + /*** + * IE 8+, Firefox 2+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+ + */ + sessionStorage: amplifyStorageTypeStore; + + /*** + * Firefox 2+ + */ + globalStorage: amplifyStorageTypeStore; + + /*** + * IE 5 - 7 + */ + userData: amplifyStorageTypeStore; + + /*** + * An in-memory store is provided as a fallback if none of the other storage types are available. + */ + memory: amplifyStorageTypeStore; + + +} + +interface amplifyStatic { + + subscribe: amplifySubscribe; + + /*** + * Remove a subscription. + * topic: The topic being unsubscribed from. + * callback: The callback that was originally subscribed. + */ + unsubscribe(topic: string, callback: Function): void; + + /*** + * Publish a message. + * topic: The name of the message to publish. + * Any additional parameters will be passed to the subscriptions. + * amplify.publish returns a boolean indicating whether any subscriptions returned false. The return value is true if none of the subscriptions returned false, and false otherwise. Note that only one subscription can return false because doing so will prevent additional subscriptions from being invoked. + */ + publish(topic: string, ...args: any[]): boolean; + + store: amplifyStore; + + request: amplifyRequest; + +} + +declare var amplify: amplifyStatic; + From 2c55e6f76c8799c5a0b3a5c7e4cfc6da00aeaa4f Mon Sep 17 00:00:00 2001 From: Sebastian Lenz Date: Tue, 8 Sep 2015 12:18:05 +0200 Subject: [PATCH 028/329] Rename "node-progress" to "progress" --- node-progress/node-progress-test.ts => progress/progress-test.ts | 0 node-progress/node-progress.d.ts => progress/progress.d.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename node-progress/node-progress-test.ts => progress/progress-test.ts (100%) rename node-progress/node-progress.d.ts => progress/progress.d.ts (100%) diff --git a/node-progress/node-progress-test.ts b/progress/progress-test.ts similarity index 100% rename from node-progress/node-progress-test.ts rename to progress/progress-test.ts diff --git a/node-progress/node-progress.d.ts b/progress/progress.d.ts similarity index 100% rename from node-progress/node-progress.d.ts rename to progress/progress.d.ts From 5558a68cce3f867236f680e504737daaa5f0a80a Mon Sep 17 00:00:00 2001 From: Sebastian Lenz Date: Tue, 8 Sep 2015 12:20:06 +0200 Subject: [PATCH 029/329] Update test case --- progress/progress-test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/progress/progress-test.ts b/progress/progress-test.ts index 1e723aabe..699c20b05 100644 --- a/progress/progress-test.ts +++ b/progress/progress-test.ts @@ -1,4 +1,4 @@ -/// +/// var ProgressBar = require('progress'); From 9cb9e74a21d7f539f38c89317166c3538410fec3 Mon Sep 17 00:00:00 2001 From: Riron Date: Tue, 8 Sep 2015 19:10:49 +0200 Subject: [PATCH 030/329] Ionic Keyboard plugin: Add show() method --- cordova-ionic/plugins/keyboard.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cordova-ionic/plugins/keyboard.d.ts b/cordova-ionic/plugins/keyboard.d.ts index 4ff9e293d..7a1cd38e1 100644 --- a/cordova-ionic/plugins/keyboard.d.ts +++ b/cordova-ionic/plugins/keyboard.d.ts @@ -17,6 +17,14 @@ declare module Ionic { * Close the keyboard if it is open. */ close(): void; + + /** + * Force keyboard to be shown on Android. + * This typically helps if autofocus on a text element does not pop up the keyboard automatically + * + * Supported Platforms: Android, Blackberry 10 + */ + show(): void; /** * Disable native scrolling, useful if you are using JavaScript to scroll From 8e62889ba3e00c7c22807241411e18f6189eb1b1 Mon Sep 17 00:00:00 2001 From: Riron Date: Tue, 8 Sep 2015 19:15:48 +0200 Subject: [PATCH 031/329] Ionic Keyboard plugin: Update test --- cordova-ionic/cordova-ionic-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cordova-ionic/cordova-ionic-tests.ts b/cordova-ionic/cordova-ionic-tests.ts index 69d1a3d82..a88c9c580 100644 --- a/cordova-ionic/cordova-ionic-tests.ts +++ b/cordova-ionic/cordova-ionic-tests.ts @@ -7,4 +7,6 @@ cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false); cordova.plugins.Keyboard.close(); cordova.plugins.Keyboard.disableScroll(true); cordova.plugins.Keyboard.disableScroll(false); +cordova.plugins.Keyboard.show(); +cordova.plugins.Keyboard.close(); console.log(cordova.plugins.Keyboard.isVisible); From cc25ee393ebb7867f8b75bc4f856d6ed39173f35 Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Tue, 8 Sep 2015 14:09:17 -0500 Subject: [PATCH 032/329] Replace module "stream" `chunk: string` or `chunk: Buffer` arguments with `chunk: any` --- node/node.d.ts | 44 +++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index d02311e2f..7147ee479 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1671,14 +1671,13 @@ declare module "stream" { readable: boolean; constructor(opts?: ReadableOptions); _read(size: number): void; - read(size?: number): string|Buffer; + read(size?: number): any; setEncoding(encoding: string): void; pause(): void; resume(): void; pipe(destination: T, options?: { end?: boolean; }): T; unpipe(destination?: T): void; - unshift(chunk: string): void; - unshift(chunk: Buffer): void; + unshift(chunk: any): void; wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; push(chunk: any, encoding?: string): boolean; } @@ -1691,15 +1690,12 @@ declare module "stream" { export class Writable extends events.EventEmitter implements NodeJS.WritableStream { writable: boolean; constructor(opts?: WritableOptions); - _write(data: Buffer, encoding: string, callback: Function): void; - _write(data: string, encoding: string, callback: Function): void; - write(buffer: Buffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; + _write(chunk: any, encoding: string, callback: Function): void; + write(chunk: any, cb?: Function): boolean; + write(chunk: any, encoding?: string, cb?: Function): boolean; end(): void; - end(buffer: Buffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; + end(chunk: any, cb?: Function): void; + end(chunk: any, encoding?: string, cb?: Function): void; } export interface DuplexOptions extends ReadableOptions, WritableOptions { @@ -1710,15 +1706,12 @@ declare module "stream" { export class Duplex extends Readable implements NodeJS.ReadWriteStream { writable: boolean; constructor(opts?: DuplexOptions); - _write(data: Buffer, encoding: string, callback: Function): void; - _write(data: string, encoding: string, callback: Function): void; - write(buffer: Buffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; + _write(chunk: any, encoding: string, callback: Function): void; + write(chunk: any, cb?: Function): boolean; + write(chunk: any, encoding?: string, cb?: Function): boolean; end(): void; - end(buffer: Buffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; + end(chunk: any, cb?: Function): void; + end(chunk: any, encoding?: string, cb?: Function): void; } export interface TransformOptions extends ReadableOptions, WritableOptions {} @@ -1736,17 +1729,14 @@ declare module "stream" { resume(): void; pipe(destination: T, options?: { end?: boolean; }): T; unpipe(destination?: T): void; - unshift(chunk: string): void; - unshift(chunk: Buffer): void; + unshift(chunk: any): void; wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; push(chunk: any, encoding?: string): boolean; - write(buffer: Buffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; + write(chunk: any, cb?: Function): boolean; + write(chunk: any, encoding?: string, cb?: Function): boolean; end(): void; - end(buffer: Buffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; + end(chunk: any, cb?: Function): void; + end(chunk: any, encoding?: string, cb?: Function): void; } export class PassThrough extends Transform {} From c207dc9996cb588b7406b8861f8b2bdddac32ab1 Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 8 Sep 2015 12:55:33 -0700 Subject: [PATCH 033/329] Changes to DataGridView type getRowById returns a number getItemByIdx accepts an index parameter getItemMetadata returns a TotalsRowMetadata --- slickgrid/SlickGrid.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slickgrid/SlickGrid.d.ts b/slickgrid/SlickGrid.d.ts index 60f0a24b6..03fe741d9 100644 --- a/slickgrid/SlickGrid.d.ts +++ b/slickgrid/SlickGrid.d.ts @@ -1527,9 +1527,9 @@ declare module Slick { public expandGroup(...varArgs: string[]): void; public getGroups(): Group[]; public getIdxById(id: string): number; - public getRowById(): T; + public getRowById(id: string): number; public getItemById(id: any): T; - public getItemByIdx(): T; + public getItemByIdx(idx: number): T; public mapRowsToIds(rowArray: T[]): string[]; public setRefreshHints(hints: RefreshHints): void; public setFilterArgs(args: any): void; @@ -1543,7 +1543,7 @@ declare module Slick { public getLength(): number; public getItem(index: number): T; - public getItemMetadata(index?: number): void; + public getItemMetadata(index?: number): TotalsRowMetadata; public onRowCountChanged: Slick.Event; public onRowsChanged: Slick.Event; From ff104ed7cc13a3eb2e89f46242c4dbdbbe66665e Mon Sep 17 00:00:00 2001 From: Roman Fromrome Date: Tue, 8 Sep 2015 15:59:55 -0700 Subject: [PATCH 034/329] optional expectationFailOutput parameter added to matchers optional expectationFailOutput parameter added to matchers for ability to track expectation fail reason in output message --- jasmine/jasmine.d.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index 581353b34..184875fa2 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -58,7 +58,7 @@ declare module jasmine { function addMatchers(matchers: CustomMatcherFactories): void; function stringMatching(str: string): Any; function stringMatching(str: RegExp): Any; - + interface Any { new (expectedClass: any): any; @@ -72,7 +72,7 @@ declare module jasmine { length: number; [n: number]: T; } - + interface ArrayContaining { new (sample: any[]): any; @@ -279,21 +279,21 @@ declare module jasmine { isNot?: boolean; message(): any; - toBe(expected: any): boolean; - toEqual(expected: any): boolean; - toMatch(expected: any): boolean; - toBeDefined(): boolean; - toBeUndefined(): boolean; - toBeNull(): boolean; + toBe(expected: any, expectationFailOutput?: any): boolean; + toEqual(expected: any, expectationFailOutput?: any): boolean; + toMatch(expected: any, expectationFailOutput?: any): boolean; + toBeDefined(expectationFailOutput?: any): boolean; + toBeUndefined(expectationFailOutput?: any): boolean; + toBeNull(expectationFailOutput?: any): boolean; toBeNaN(): boolean; - toBeTruthy(): boolean; - toBeFalsy(): boolean; + toBeTruthy(expectationFailOutput?: any): boolean; + toBeFalsy(expectationFailOutput?: any): boolean; toHaveBeenCalled(): boolean; toHaveBeenCalledWith(...params: any[]): boolean; - toContain(expected: any): boolean; - toBeLessThan(expected: any): boolean; - toBeGreaterThan(expected: any): boolean; - toBeCloseTo(expected: any, precision: any): boolean; + toContain(expected: any, expectationFailOutput?: any): boolean; + toBeLessThan(expected: any, expectationFailOutput?: any): boolean; + toBeGreaterThan(expected: any, expectationFailOutput?: any): boolean; + toBeCloseTo(expected: any, precision: any, expectationFailOutput?: any): boolean; toContainHtml(expected: string): boolean; toContainText(expected: string): boolean; toThrow(expected?: any): boolean; @@ -450,7 +450,7 @@ declare module jasmine { /** By chaining the spy with calls.reset(), will clears all tracking for a spy **/ reset(): void; } - + interface CallInfo { /** The context (the this) for the call */ object: any; From 79dfea3815d3731bf89afb96e15be8c77a9035cb Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 8 Sep 2015 22:45:18 -0400 Subject: [PATCH 035/329] `IInjectorService.get` has an optional 2nd param. `caller` is an optional string to provide the origin of the function call for error messages. https://docs.angularjs.org/api/auto/service/$injector#get --- angularjs/angular.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index d183167b5..90cf10a88 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1693,7 +1693,7 @@ declare module angular { interface IInjectorService { annotate(fn: Function): string[]; annotate(inlineAnnotatedFunction: any[]): string[]; - get(name: string): T; + get(name: string, caller?: string): T; has(name: string): boolean; instantiate(typeConstructor: Function, locals?: any): T; invoke(inlineAnnotatedFunction: any[]): any; From 44ccd778df52b56c320c45e3d8eaf02296c1e366 Mon Sep 17 00:00:00 2001 From: Artem Berezin Date: Wed, 9 Sep 2015 15:24:14 +1000 Subject: [PATCH 036/329] Update angularjs-toaster.d.ts fix typo: into -> info --- angularjs-toaster/angularjs-toaster.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs-toaster/angularjs-toaster.d.ts b/angularjs-toaster/angularjs-toaster.d.ts index 398704514..9f450b14b 100644 --- a/angularjs-toaster/angularjs-toaster.d.ts +++ b/angularjs-toaster/angularjs-toaster.d.ts @@ -16,7 +16,7 @@ declare module ngtoaster { error(params: IPopParams): void error(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, toasterId?:number): void - into(params: IPopParams): void + info(params: IPopParams): void info(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, toasterId?:number): void wait(params: IPopParams): void From a42706711d711cf12ec26b8bb5f08520fc948253 Mon Sep 17 00:00:00 2001 From: Bill Chen Date: Wed, 19 Aug 2015 17:29:20 +0100 Subject: [PATCH 037/329] Completely typed AngularJS $http. Merged the defaults, added missing typings and refined others. --- angular-growl-v2/angular-growl-v2.d.ts | 2 +- angularjs/angular.d.ts | 138 +++++++++++++++---------- 2 files changed, 84 insertions(+), 56 deletions(-) diff --git a/angular-growl-v2/angular-growl-v2.d.ts b/angular-growl-v2/angular-growl-v2.d.ts index 1c324723f..81338aaca 100644 --- a/angular-growl-v2/angular-growl-v2.d.ts +++ b/angular-growl-v2/angular-growl-v2.d.ts @@ -45,7 +45,7 @@ declare module angular.growl { /** * Pre-defined server error interceptor. */ - serverMessagesInterceptor: (string|Function)[]; + serverMessagesInterceptor: (string|IHttpInterceptorFactory)[]; /** * Set default TTL settings. diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index d183167b5..b99cd15c4 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1312,51 +1312,25 @@ declare module angular { /** * Runtime equivalent of the $httpProvider.defaults property. Allows configuration of default headers, withCredentials as well as request and response transformations. */ - defaults: IRequestConfig; + defaults: IHttpProviderDefaults; /** * Array of config objects for currently pending requests. This is primarily meant to be used for debugging purposes. */ - pendingRequests: any[]; + pendingRequests: IRequestConfig[]; } /** * Object describing the request to be made and how it should be processed. * see http://docs.angularjs.org/api/ng/service/$http#usage */ - interface IRequestShortcutConfig { + interface IRequestShortcutConfig extends IHttpProviderDefaults { /** * {Object.} * Map of strings or objects which will be turned to ?key1=value1&key2=value2 after the url. If the value is not a string, it will be JSONified. */ params?: any; - /** - * Map of strings or functions which return strings representing HTTP headers to send to the server. If the return value of a function is null, the header will not be sent. - */ - headers?: any; - - /** - * Name of HTTP header to populate with the XSRF token. - */ - xsrfHeaderName?: string; - - /** - * Name of cookie containing the XSRF token. - */ - xsrfCookieName?: string; - - /** - * {boolean|Cache} - * If true, a default $http cache will be used to cache the GET request, otherwise if a cache instance built with $cacheFactory, this cache will be used for caching. - */ - cache?: any; - - /** - * whether to to set the withCredentials flag on the XHR object. See [requests with credentials]https://developer.mozilla.org/en/http_access_control#section_5 for more information. - */ - withCredentials?: boolean; - /** * {string|Object} * Data to be sent as the request message data. @@ -1364,25 +1338,12 @@ declare module angular { data?: any; /** - * {function(data, headersGetter)|Array.} - * Transform function or an array of such functions. The transform function takes the http request body and headers and returns its transformed (typically serialized) version. - */ - transformRequest?: any; - - /** - * {function(data, headersGetter)|Array.} - * Transform function or an array of such functions. The transform function takes the http response body and headers and returns its transformed (typically deserialized) version. - */ - transformResponse?: any; - - /** - * {number|Promise} * Timeout in milliseconds, or promise that should abort the request when resolved. */ - timeout?: any; + timeout?: number|IPromise; /** - * See requestType. + * See [XMLHttpRequest.responseType]https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype */ responseType?: string; } @@ -1425,31 +1386,98 @@ declare module angular { then(successCallback: (response: IHttpPromiseCallbackArg) => IPromise|TResult, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; } + // See the jsdoc for transformData() at https://github.com/angular/angular.js/blob/master/src/ng/http.js#L228 + interface IHttpResquestTransformer { + (data: any, headersGetter: IHttpHeadersGetter): any; + } + + // The definition of fields are the same as IHttpPromiseCallbackArg + interface IHttpResponseTransformer { + (data: any, headersGetter: IHttpHeadersGetter, status: number): any; + } + + interface IHttpRequestConfigHeaders { + [requestType: string]: string|(() => string); + common?: string|(() => string); + get?: string|(() => string); + post?: string|(() => string); + put?: string|(() => string); + patch?: string|(() => string); + } + /** - * Object that controls the defaults for $http provider + * Object that controls the defaults for $http provider. Not all fields of IRequestShortcutConfig can be configured + * via defaults and the docs do not say which. The following is based on the inspection of the source code. * https://docs.angularjs.org/api/ng/service/$http#defaults + * https://docs.angularjs.org/api/ng/service/$http#usage + * https://docs.angularjs.org/api/ng/provider/$httpProvider The properties section */ interface IHttpProviderDefaults { - cache?: boolean; + /** + * {boolean|Cache} + * If true, a default $http cache will be used to cache the GET request, otherwise if a cache instance built with $cacheFactory, this cache will be used for caching. + */ + cache?: any; + /** * Transform function or an array of such functions. The transform function takes the http request body and * headers and returns its transformed (typically serialized) version. + * @see {@link https://docs.angularjs.org/api/ng/service/$http#transforming-requests-and-responses} */ - transformRequest?: ((data: any, headersGetter?: any) => any)|((data: any, headersGetter?: any) => any)[]; - xsrfCookieName?: string; + transformRequest?: IHttpResquestTransformer |IHttpResquestTransformer[]; + + /** + * Transform function or an array of such functions. The transform function takes the http response body and + * headers and returns its transformed (typically deserialized) version. + */ + transformResponse?: IHttpResponseTransformer | IHttpResponseTransformer[]; + + /** + * Map of strings or functions which return strings representing HTTP headers to send to the server. If the + * return value of a function is null, the header will not be sent. + * The key of the map is the request verb in lower case. The "common" key applies to all requests. + * @see {@link https://docs.angularjs.org/api/ng/service/$http#setting-http-headers} + */ + headers?: IHttpRequestConfigHeaders; + + /** Name of HTTP header to populate with the XSRF token. */ xsrfHeaderName?: string; + + /** Name of cookie containing the XSRF token. */ + xsrfCookieName?: string; + + /** + * whether to to set the withCredentials flag on the XHR object. See [requests with credentials]https://developer.mozilla.org/en/http_access_control#section_5 for more information. + */ withCredentials?: boolean; - headers?: { - common?: any; - post?: any; - put?: any; - patch?: any; - } + + /** + * A function used to the prepare string representation of request parameters (specified as an object). If + * specified as string, it is interpreted as a function registered with the $injector. Defaults to + * $httpParamSerializer. + */ + paramSerializer?: string | ((obj: any) => string); + } + + interface IHttpInterceptor { + request?: (config: IRequestConfig) => IRequestConfig|IPromise; + requestError?: (rejection: any) => any; + response?: (response: IHttpPromiseCallbackArg) => IPromise|T; + responseError?: (rejection: any) => any; + } + + interface IHttpInterceptorFactory { + (...args: any[]): IHttpInterceptor; } interface IHttpProvider extends IServiceProvider { defaults: IHttpProviderDefaults; - interceptors: any[]; + + /** + * Register service factories (names or implementations) for interceptors which are called before and after + * each request. + */ + interceptors: (string|IHttpInterceptorFactory|(string|IHttpInterceptorFactory)[])[]; useApplyAsync(): boolean; useApplyAsync(value: boolean): IHttpProvider; From 6a4bf3433dabc22f3f7a4557572c6c56c720ea34 Mon Sep 17 00:00:00 2001 From: Gregor Woiwode Date: Wed, 9 Sep 2015 12:00:12 +0200 Subject: [PATCH 038/329] Adds missing t to SimplebarOptions --- simplebar/simplebar.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/simplebar/simplebar.d.ts b/simplebar/simplebar.d.ts index 63173f432..bab795e1a 100755 --- a/simplebar/simplebar.d.ts +++ b/simplebar/simplebar.d.ts @@ -3,9 +3,9 @@ // Definitions by: Gregor Woiwode // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface SimplebarOpions { +interface SimplebarOptions { autoHide?: boolean; - wrapContent?: boolean + wrapContent?: boolean; } interface JQuery { @@ -18,7 +18,7 @@ interface JQuery { * * @param indicator if scrollbar should be faded out automatically. */ - (options?: SimplebarOpions): JQuery; + (options?: SimplebarOptions): JQuery; }; } @@ -32,6 +32,6 @@ interface JQueryStatic { * * @param indicator if scrollbar should be faded out automatically. */ - (options?: SimplebarOpions): JQuery; + (options?: SimplebarOptions): JQuery; }; } From 45355cd1a55145748313f8e6d938f6df0f4de131 Mon Sep 17 00:00:00 2001 From: Panu Horsmalahti Date: Wed, 9 Sep 2015 13:15:35 +0300 Subject: [PATCH 039/329] Add more fs.write interfaces. --- node/node-tests.ts | 2 ++ node/node.d.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/node/node-tests.ts b/node/node-tests.ts index 19f686ef5..a73a35e22 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -34,6 +34,8 @@ assert.doesNotThrow(() => { fs.writeFile("thebible.txt", "Do unto others as you would have them do unto you.", assert.ifError); + +fs.write(1234, "test"); fs.writeFile("Harry Potter", "\"You be wizzing, Harry,\" jived Dumbledore.", diff --git a/node/node.d.ts b/node/node.d.ts index b7edca1f7..bc1229e63 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1214,6 +1214,9 @@ declare module "fs" { export function fsyncSync(fd: number): void; export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; export function write(fd: number, buffer: Buffer, offset: number, length: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; + export function write(fd: number, data: any, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + export function write(fd: number, data: any, offset: number, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + export function write(fd: number, data: any, offset: number, encoding: string, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void; export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; From 3c3c84e2158e0dc026c00549be973e49ac024d33 Mon Sep 17 00:00:00 2001 From: Martin McWhorter Date: Wed, 9 Sep 2015 18:07:21 +0100 Subject: [PATCH 040/329] Angulartics Settings Provider Add setting which can be set directly through provider. Use case: you want to strip off the slash in the basePath -- using the settings in the provider allows you to modify the basePath as you like. --- angulartics/angulartics-tests.ts | 2 ++ angulartics/angulartics.d.ts | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/angulartics/angulartics-tests.ts b/angulartics/angulartics-tests.ts index cc816a2ab..4e2a57cca 100644 --- a/angulartics/angulartics-tests.ts +++ b/angulartics/angulartics-tests.ts @@ -20,6 +20,8 @@ module Analytics { $analyticsProvider.registerPageTrack((path: string, locationObj: ng.ILocationService) => { console.log("viewed " + path); }); + + $analyticsProvider.settings.pageTracking.basePath = "/my/base/path"; }]); } diff --git a/angulartics/angulartics.d.ts b/angulartics/angulartics.d.ts index 8c8957569..bb7caa5ac 100644 --- a/angulartics/angulartics.d.ts +++ b/angulartics/angulartics.d.ts @@ -33,6 +33,16 @@ declare module Angulartics { registerSetUsername(callback: (username: string) => any): void registerSetUserProperties(callback: (userProperties: any) => any): void registerSetSuperProperties(callback: (superProperties: any) => any): void + + settings: { + pageTracking: { + autoTrackingVirtualPages: boolean, + autoTrackingFirstPage: boolean, + basePath: string, + autoBasePath: boolean + }, + developerMode: boolean + } } } From 44b86737dabf2dc8377b355559d2ceced5feada8 Mon Sep 17 00:00:00 2001 From: Dan Lewi Harkestad Date: Wed, 9 Sep 2015 19:34:04 +0200 Subject: [PATCH 041/329] Changed to single quotes per review feedback. --- ui-grid/ui-grid-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-grid/ui-grid-tests.ts b/ui-grid/ui-grid-tests.ts index 4eedf8675..f4bcdce7e 100644 --- a/ui-grid/ui-grid-tests.ts +++ b/ui-grid/ui-grid-tests.ts @@ -100,7 +100,7 @@ gridApi.core.queueGridRefresh() gridApi.core.queueRefresh(); gridApi.core.registerColumnsProcessor(colProcessor, 100); -var rowEntityToScrollTo = {anObject: "inGridOptionsData"}; +var rowEntityToScrollTo = {anObject: 'inGridOptionsData'}; var columnDefToScrollTo: uiGrid.IColumnDef; gridInstance.scrollTo(); gridInstance.scrollTo(rowEntityToScrollTo); From 4a86ba7d7f9227dc68c970f05dd667992fd8f40a Mon Sep 17 00:00:00 2001 From: Ryan McNamara Date: Wed, 9 Sep 2015 11:19:57 -0700 Subject: [PATCH 042/329] added definitely typed files and tests for flowjs and ngflow --- flowjs/flow/flowjs-tests.ts | 78 ++++++++++++++++++++++++++++++ flowjs/flow/flowjs.d.ts | 85 +++++++++++++++++++++++++++++++++ flowjs/ng-flow/ng-flow-tests.ts | 4 ++ flowjs/ng-flow/ng-flow.d.ts | 11 +++++ 4 files changed, 178 insertions(+) create mode 100644 flowjs/flow/flowjs-tests.ts create mode 100644 flowjs/flow/flowjs.d.ts create mode 100644 flowjs/ng-flow/ng-flow-tests.ts create mode 100644 flowjs/ng-flow/ng-flow.d.ts diff --git a/flowjs/flow/flowjs-tests.ts b/flowjs/flow/flowjs-tests.ts new file mode 100644 index 000000000..8bedad003 --- /dev/null +++ b/flowjs/flow/flowjs-tests.ts @@ -0,0 +1,78 @@ +/// + +// flow object +var flowObject: flowjs.IFlow; +var bool: boolean = flowObject.support; +bool = flowObject.supportDirectory; +var obj: Object = flowObject.opts; +var flowFileArray: flowjs.IFlowFile[] = flowObject.files; + +flowObject.assignBrowse( [], false, false, {}); +flowObject.assignDrop( []); +flowObject.unAssignDrop( []); +flowObject.on("", () => {}); +flowObject.off("", () => {}); +flowObject.upload(); +flowObject.pause(); +flowObject.resume(); +flowObject.cancel(); +flowObject.progress(); +bool = flowObject.isUploading(); +flowObject.addFile( {}); +flowObject.removeFile( {}); +var flowFile: flowjs.IFlowFile = flowObject.getFromUniqueIdentifier(""); +var num: number = flowObject.getSize(); +num = flowObject.sizeUploaded(); +num = flowObject.timeRemaining(); + +// flow options +var flowOptions: flowjs.IFlowOptions = {}; +flowOptions.target = ""; +flowOptions.singleFile = true; +flowOptions.chunkSize= 0; +flowOptions.forceChunkSize = true; +flowOptions.simultaneousUploads= 0; +flowOptions.fileParameterName = ""; +flowOptions.query = {}; +flowOptions.headers = {}; +flowOptions.withCredentials = true; +flowOptions.method = ""; +flowOptions.testMethod = ""; +flowOptions.uploadMethod = ""; +flowOptions.allowDuplicateUploads = true; +flowOptions.prioritizeFirstAndLastChunk = true; +flowOptions.testchunks = true; +flowOptions.preprocess = () => {}; +flowOptions.initFileFn = () => {}; +flowOptions.generateUniqueIdentifier = () => {}; +flowOptions.maxChunkRetries= 0; +flowOptions.chunkRetryInterval= 0; +flowOptions.progressCallbacksInterval= 0; +flowOptions.speedSmoothingFactor= 0; +flowOptions.successStatuses = [""]; +flowOptions.permanentErrors = [""]; + +// flow file +flowObject = flowFile.flowObj; +var htmlFile: File = flowFile.file; +var str: string = flowFile.name; +str = flowFile.relativePath; +num = flowFile.size; +str = flowFile.uniqueIdentifier; +num = flowFile.averageSpeed; +num = flowFile.currentSpeed; +var anyArray: any[] = flowFile.chunks; +bool = flowFile.paused; +bool = flowFile.error; +num = flowFile.progress(true); +flowFile.pause(); +flowFile.resume(); +flowFile.cancel(); +flowFile.retry(); +flowFile.bootstrap(); +bool = flowFile.isUploading(); +bool = flowFile.isComplete; +num = flowFile.sizeUploaded; +num = flowFile.timeRemaining; +str = flowFile.getExtension; +str = flowFile.getType; diff --git a/flowjs/flow/flowjs.d.ts b/flowjs/flow/flowjs.d.ts new file mode 100644 index 000000000..e9e90055b --- /dev/null +++ b/flowjs/flow/flowjs.d.ts @@ -0,0 +1,85 @@ +// Type definitions for flowjs +// Project: https://github.com/flowjs/flow.js +// Definitions by: Ryan McNamara +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module flowjs { + interface IFlow { + support: boolean; + supportDirectory: boolean; + opts: Object; + files: IFlowFile[]; + + assignBrowse(domNodes: HTMLElement[], isDirectory: boolean, singleFile: boolean, attributes: Object): void; + assignDrop(domNodes: HTMLElement[]): void; + unAssignDrop(domNodes: HTMLElement[]): void; + on(event: string, callback: Function): void; + off(event?: string, callback?: Function): void; + upload(): void; + pause(): void; + resume(): void; + cancel(): void; + progress(): number; + isUploading(): boolean; + addFile(file: File): void; + removeFile(file: IFlowFile): void; + getFromUniqueIdentifier(uniqueIdentifier: string): IFlowFile; + getSize(): number; + sizeUploaded(): number; + timeRemaining(): number; + } + + interface IFlowOptions { + target?: string; + singleFile?: boolean; + chunkSize?: number; + forceChunkSize?: boolean; + simultaneousUploads?: number; + fileParameterName?: string; + query?: Object; + headers?: Object; + withCredentials?: boolean; + method?: string; + testMethod?: string; + uploadMethod?: string; + allowDuplicateUploads?: boolean; + prioritizeFirstAndLastChunk?: boolean; + testchunks?: boolean; + preprocess?: Function; + initFileFn?: Function; + generateUniqueIdentifier?: Function; + maxChunkRetries?: number; + chunkRetryInterval?: number; + progressCallbacksInterval?: number; + speedSmoothingFactor?: number; + successStatuses?: string[]; + permanentErrors?: string[]; + } + + interface IFlowFile { + flowObj: IFlow; + file: File; + name: string; + relativePath: string; + size: number; + uniqueIdentifier: string; + averageSpeed: number; + currentSpeed: number; + chunks: any[]; + paused: boolean; + error: boolean; + + progress(relative: boolean): number; + pause(): void; + resume(): void; + cancel(): void; + retry(): void; + bootstrap(): void; + isUploading(): boolean; + isComplete: boolean; + sizeUploaded: number; + timeRemaining: number; + getExtension: string; + getType: string; + } +} diff --git a/flowjs/ng-flow/ng-flow-tests.ts b/flowjs/ng-flow/ng-flow-tests.ts new file mode 100644 index 000000000..beca6583c --- /dev/null +++ b/flowjs/ng-flow/ng-flow-tests.ts @@ -0,0 +1,4 @@ +/// + +var flowFactory: ng.flow.IFlowFactory; +flowFactory.create( {}); diff --git a/flowjs/ng-flow/ng-flow.d.ts b/flowjs/ng-flow/ng-flow.d.ts new file mode 100644 index 000000000..4ea0afefe --- /dev/null +++ b/flowjs/ng-flow/ng-flow.d.ts @@ -0,0 +1,11 @@ +// Type definitions for ng-flow +// Project: https://github.com/flowjs/ng-flow +// Definitions by: Ryan McNamara +// Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + +declare module ng.flow { + interface IFlowFactory { + create(options?: flowjs.IFlowOptions): flowjs.IFlow; + } +} From d450115aeffc58f11925d77c014e28f9d4fda866 Mon Sep 17 00:00:00 2001 From: Joe Skeen Date: Wed, 9 Sep 2015 15:52:16 -0600 Subject: [PATCH 043/329] fixed reference to the IGridRow type to refer to uiGrid.IGridRow within ui-grid plugins --- ui-grid/ui-grid.d.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 5f66eca1f..5cc3886f7 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -1182,14 +1182,14 @@ declare module uiGrid { } export interface IRowColConstructor { - new (row: IGridRow, col: IGridColumn): IRowCol; + new (row: uiGrid.IGridRow, col: IGridColumn): IRowCol; } /** * A row and column pair that represents the intersection of these two entities */ export interface IRowCol { - row: IGridRow; + row: uiGrid.IGridRow; col: IGridColumn; /** * Gets the intersection of where the row and column meet @@ -1282,7 +1282,7 @@ declare module uiGrid { reader.readAsText( files[0] ); } */ - editFileChooserCallback?: (gridRow: IGridRow, gridCol: IGridColumn, files: FileList) => void; + editFileChooserCallback?: (gridRow: uiGrid.IGridRow, gridCol: IGridColumn, files: FileList) => void; /** * A bindable string value that is used when binding to edit controls instead of colDef.field * For example if you have a complex property on an object like: @@ -1558,7 +1558,7 @@ declare module uiGrid { * @param {any} value The cell value * @returns {any} Formatted value */ - exporterFieldCallback?: (grid: IGridInstance, row: IGridRow, col: IGridColumn, value: any) => any; + exporterFieldCallback?: (grid: IGridInstance, row: uiGrid.IGridRow, col: IGridColumn, value: any) => any; /** * A function to apply to the header displayNames before exporting. Useful for internationalisation, * for example if you were using angular-translate you'd set this to $translate.instant. @@ -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: IGridRow, event?: ng.IAngularEvent): void; + selectRow(rowEntity: uiGrid.IGridRow, 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: IGridRow, event?: ng.IAngularEvent): void; + toggleRowSelection(rowEntity: uiGrid.IGridRow, 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: IGridRow, event?: ng.IAngularEvent): void; + unSelectRow(rowEntity: uiGrid.IGridRow, event?: ng.IAngularEvent): void; // Events on: { @@ -2903,7 +2903,7 @@ declare module uiGrid { * @param {IGridRow} row The selected rows * @param {ng.IAngularEvent} event object if raised from event */ - (row: IGridRow, event?: ng.IAngularEvent): void; + (row: uiGrid.IGridRow, event?: ng.IAngularEvent): void; } export interface rowSelectionChangedBatchHandler { @@ -2912,7 +2912,7 @@ declare module uiGrid { * @param {IGridRow} row The selected rows * @param {ng.IAngularEvent} event object if raised from event */ - (row: Array, event?: ng.IAngularEvent): void; + (row: Array, event?: ng.IAngularEvent): void; } } From 0b289d58d920cc18b234948faae77e3513707b30 Mon Sep 17 00:00:00 2001 From: Anthony Guo Date: Wed, 9 Sep 2015 16:31:49 -0700 Subject: [PATCH 044/329] Add typings for CodeMirror's searchcursor add-on --- codemirror/searchcursor-tests.ts | 16 ++++++++++++ codemirror/searchcursor.d.ts | 45 ++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 codemirror/searchcursor-tests.ts create mode 100644 codemirror/searchcursor.d.ts diff --git a/codemirror/searchcursor-tests.ts b/codemirror/searchcursor-tests.ts new file mode 100644 index 000000000..2e87a8b59 --- /dev/null +++ b/codemirror/searchcursor-tests.ts @@ -0,0 +1,16 @@ +/// +/// + +var doc = new CodeMirror.Doc('text some string and another text match'); +var cursor = doc.getSearchCursor('text', new CodeMirror.Pos(0,0), false); +cursor = doc.getSearchCursor('text', new CodeMirror.Pos(0,0)); +cursor = doc.getSearchCursor('text'); + + +cursor.find(false); +cursor.findNext(); +cursor.findPrevious(); +cursor.from(); +cursor.to(); +cursor.replace("blah"); +cursor.replace("text", "origin"); diff --git a/codemirror/searchcursor.d.ts b/codemirror/searchcursor.d.ts new file mode 100644 index 000000000..ed7af7a25 --- /dev/null +++ b/codemirror/searchcursor.d.ts @@ -0,0 +1,45 @@ +// Type definitions for CodeMirror +// Project: https://github.com/marijnh/CodeMirror +// Definitions by: jacqt +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module CodeMirror { + interface Doc { + /** This method can be used to implement search/replace functionality. + * `query`: This can be a regular * expression or a string (only strings will match across lines - + * if they contain newlines). + * `start`: This provides the starting position of the search. It can be a `{line, ch} object, + * or can be left off to default to the start of the document + * `caseFold`: This is only relevant when matching a string. IT will cause the search to be case-insenstive */ + getSearchCursor(query: string | RegExp, start?: Position, caseFold?: boolean): SearchCursor; + } + + interface SearchCursor { + /** Searches forward or backward from the current position. The return value indicates whether a match was + * found. If matching a regular expression, the return value will be the array returned by the match method, in case + * you want to extract matched groups */ + find(reverse: boolean): boolean | any[]; + + /** Searches forward from the current position. The return value indicates whether a match was + * found. If matching a regular expression, the return value will be the array returned by the match method, in case + * you want to extract matched groups */ + findNext(): boolean | any[]; + + /** Searches backward from the current position. The return value indicates whether a match was + * found. If matching a regular expression, the return value will be the array returned by the match method, in case + * you want to extract matched groups */ + findPrevious(): boolean | any[]; + + /** Only valid when the last call to find, findNext, or findPrevious did not return false. Returns {line, ch} + * objects pointing the start of the match. */ + from(): Position; + + /** Only valid when the last call to find, findNext, or findPrevious did not return false. Returns {line, ch} + * objects pointing the end of the match. */ + to(): Position; + + + /** Replaces the currently found match with the given text and adjusts the cursor position to reflect the deplacement. */ + replace(text: string, origin?: string): void; + } +} From 2332fe2eaaed877248ac845491821cc5eb4179e5 Mon Sep 17 00:00:00 2001 From: Ritzlgrmft Date: Thu, 10 Sep 2015 10:36:36 +0200 Subject: [PATCH 045/329] 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 046/329] 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 047/329] 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 048/329] 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 049/329] 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 050/329] 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 051/329] 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 812e510f7da9910aa81eed3dc0c60ec5686a1257 Mon Sep 17 00:00:00 2001 From: diontools Date: Fri, 11 Sep 2015 18:28:51 +0900 Subject: [PATCH 052/329] SwipeRecognizer extends AttrRecognizer --- hammerjs/hammerjs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hammerjs/hammerjs.d.ts b/hammerjs/hammerjs.d.ts index 84d4f9431..4d1091f68 100644 --- a/hammerjs/hammerjs.d.ts +++ b/hammerjs/hammerjs.d.ts @@ -302,7 +302,7 @@ interface SwipeRecognizerStatic new( options?:any ):SwipeRecognizer; } -interface SwipeRecognizer +interface SwipeRecognizer extends AttrRecognizer { } From aebfb46ca90d7d0ed7aafc951cba7041570963d8 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 Sep 2015 11:42:02 +0200 Subject: [PATCH 053/329] angular-animate - updated enabled --- angularjs/angular-animate.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angularjs/angular-animate.d.ts b/angularjs/angular-animate.d.ts index 1ecc3d0d7..35fe10ca9 100644 --- a/angularjs/angular-animate.d.ts +++ b/angularjs/angular-animate.d.ts @@ -30,11 +30,11 @@ declare module angular.animate { /** * Globally enables / disables animations. * - * @param value If provided then set the animation on or off. * @param element If provided then the element will be used to represent the enable/disable operation. + * @param value If provided then set the animation on or off. * @returns current animation state */ - enabled(value?: boolean, element?: JQuery): boolean; + enabled(element?: JQuery, value?: boolean): boolean; /** * Performs an inline animation on the element. From b89ecfca5b33513238ff5b5444e4bfdc3be8da50 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 Sep 2015 14:36:42 +0200 Subject: [PATCH 054/329] Added definitions for ng-command --- tooltipster/tooltipster-tests.ts | 15 ++ tooltipster/tooltipster.d.ts | 278 +++++++++++++++++++++++++++++++ 2 files changed, 293 insertions(+) create mode 100644 tooltipster/tooltipster-tests.ts create mode 100644 tooltipster/tooltipster.d.ts diff --git a/tooltipster/tooltipster-tests.ts b/tooltipster/tooltipster-tests.ts new file mode 100644 index 000000000..5ca867ec1 --- /dev/null +++ b/tooltipster/tooltipster-tests.ts @@ -0,0 +1,15 @@ +/// + +$(function() { + const tooltips = $("#tooltip").tooltipster({ + content: "hi friend!", + delay: 300, + functionAfter: (origin) => { + console.log("tooltip closed!"); + }, + multiple: true + }); + tooltips[0].show(); + tooltips[0].hide(); + tooltips[0].destroy(); +}); \ No newline at end of file diff --git a/tooltipster/tooltipster.d.ts b/tooltipster/tooltipster.d.ts new file mode 100644 index 000000000..ec1529570 --- /dev/null +++ b/tooltipster/tooltipster.d.ts @@ -0,0 +1,278 @@ +// Type definitions for tooltipster +// Project: https://github.com/iamceege/tooltipster +// Definitions by: Stephen Lautier +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + + +declare module JQueryTooltipster { + /** + * Tooltipster options @see http://iamceege.github.io/tooltipster/ + */ + export interface ITooltipsterOptions { + + /** + * Determines how the tooltip will animate in and out. Feel free to modify or create custom transitions in the tooltipster.css file. + * In IE9 and 8, all animations default to a JavaScript generated, fade animation. Default: 'fade' + */ + animation?: string; + + /** + * Adds the "speech bubble arrow" to the tooltip. Default: true + */ + arrow?: boolean; + + /** + * Select a specific color for the "speech bubble arrow". Default: will inherit the tooltip's background color + */ + arrowColor?: string; + + /** + * If autoClose is set to false, the tooltip will never close unless you call the 'hide' method yourself. Default: true + */ + autoClose?: boolean; + + /** + * If set, this will override the content of the tooltip. Default: null + */ + content?: string; + + /** + * If the content of the tooltip is provided as a string, it is displayed as plain text by default. + * If this content should actually be interpreted as HTML, set this option to true. Default: false + */ + contentAsHTML?: string; + + /** + * If you provide a jQuery object to the 'content' option, this sets if it is a clone of this object that should actually be used. Default: true + */ + contentCloning?: boolean; + + /** + * Tooltipster logs notices into the console when you're doing something you ideally shouldn't be doing. Set to false to disable logging. Default: true + */ + debug?: boolean; + + /** + * Delay how long it takes (in milliseconds) for the tooltip to start animating in. Default: 200 + */ + delay?: number; + + /** + * Set a minimum width for the tooltip. Default: 0 (auto width) + */ + minWidth?: number; + + /** + * Set a maximum width for the tooltip. Default: null (no max width) + */ + maxWidth?: number; + + /** + * Create a custom function to be fired only once at instantiation. If the function returns a value, this value will become the content of the tooltip. + * @param origin + * @param content + */ + functionInit?: (origin, content) => void; + + /** + * Create a custom function to be fired before the tooltip opens. This function may prevent or hold off the opening. + * @param origin + * @param continueTooltip + */ + functionBefore?: (origin, continueTooltip) => void; + + /** + * Create a custom function to be fired when the tooltip and its contents have been added to the DOM. + * @param origin + * @param tooltip + */ + functionReady?: (origin, tooltip) => void; + + /** + * Create a custom function to be fired once the tooltip has been closed and removed from the DOM. + * @param origin + */ + functionAfter?: (origin) => void; + + /** + * If true, the tooltip will close if its origin is clicked. This option only applies when 'trigger' is 'hover' and 'autoClose' is false. Default: false + */ + hideOnClick?: boolean; + + /** + * If using the iconDesktop or iconTouch options, this sets the content for your icon. Default: '(?)' + */ + icon?: string|JQuery; + + /** + * If you provide a jQuery object to the 'icon' option, this sets if it is a clone of this object that should actually be used. Default: true + */ + iconCloning?: boolean; + + /** + * Generate an icon next to your content that is responsible for activating the tooltip on non-touch devices. Default: false + */ + iconDesktop?: boolean; + + /** + * If using the iconDesktop or iconTouch options, this sets the class on the icon (used to style the icon). Default: 'tooltipster-icon' + */ + iconTheme?: string; + + /** + * Generate an icon next to your content that is responsible for activating the tooltip on touch devices (tablets, phones, etc). Default: false + */ + iconTouch?: boolean; + + /** + * Give users the possibility to interact with the tooltip. Unless autoClose is set to false, the tooltip will still close if the user moves away from or clicks out of the tooltip. + * Default: false + */ + interactive?: boolean; + + /** + * If the tooltip is interactive and activated by a hover event, set the amount of time (milliseconds) allowed for a user to hover off + * of the tooltip activator (origin) on to the tooltip itself - keeping the tooltip from closing. Default: 350 + */ + interactiveTolerance?: number; + + /** + * Allows you to put multiple tooltips on a single element. Read further instructions down this page. Default: false + */ + multiple?: boolean; + + /** + * Offsets the tooltip (in pixels) farther left/right from the origin. Default: 0 + */ + offsetX?: number; + + /** + * Offsets the tooltip (in pixels) farther up/down from the origin. Default: 0 + */ + offsetY?: number; + + /** + * If true, only one tooltip will be allowed to be active at a time. Non-autoclosing tooltips will not be closed though. Default: false + */ + onlyOne?: boolean; + + /** + * Set the position of the tooltip. Default: 'top' + * Possible values: right, left, top, top-right, top-left, bottom, bottom-right, bottom-left + */ + position?: string; + + /** + * Will reposition the tooltip if the origin moves. As this option may have an impact on performance, we suggest you enable it only if you need to. Default: false + */ + positionTracker?: boolean; + + /** + * Called after the tooltip has been repositioned by the position tracker (if enabled). + * Default: A function that will close the tooltip if the trigger is 'hover' and autoClose is false. + */ + positionTrackerCallback?: Function; + + /** + * Specify if a TITLE attribute should be restored on the HTML element after a call to the 'destroy' method. + * This attribute may be omitted, or be restored with the value that existed before Tooltipster was initialized, or be restored with the stringified value of the current content. + * Note: in case of multiple tooltips on a single element, only the last destroyed tooltip may trigger a restoration. Default: 'current' + * + * Possible values: 'none', 'previous' or 'current' + */ + restoration?: string; + + /** + * Set the speed of the animation. Default: 350 + */ + speed?: number; + + /** + * How long the tooltip should be allowed to live before closing. Default: 0 (disabled) + */ + timer?: number; + + /** + * Set the theme (CSS class) used for your tooltip. Default: 'tooltipster-default' + */ + theme?: string; + + /** + * + * If set to false, tooltips will not show on pure-touch devices, unless you open them yourself with the 'show' method. + * Touch gestures on devices which also have a mouse will still open the tooltips though. Default: true + */ + touchDevices?: boolean; + + /** + * Set how tooltips should be activated and closed. + * Possible values: hover, click or custom. + */ + trigger?: string; + + /** + * If a tooltip is open while its content is updated, play a subtle animation when the content changes. Default: true + */ + updateAnimation?: boolean; + } + + /** + * Tooltipster tooltip instance object. + */ + export interface ITooltipsterInstance { + + /** + * Updates the content of the tooltip. + * @param value + * @returns {} + */ + content(value: string); + + /** + * Shows the tooltip. + */ + show(): void; + + /** + * Hides the tooltip (this will aslo causo it to be removed from the DOM, not simply hides it), however leaving the listeners. + */ + hide(): void; + + /** + * Disables the tooltip, causing it to not show unless its re-enabled. + */ + disable(): void; + + /** + * Enables the tooltip. + */ + enable(): void; + + /** + * Destroy the tooltip and its listeners. + */ + destroy(): void; + + /** + * Reposition and resize the tooltip. + */ + reposition(): void; + + /** + * Returns the root element of the tooltip. + */ + elementTooltip(): JQuery; + + /** + * Returns the root element of the icon if there is one, otherwise 'undefined'. + */ + elementIcon(): JQuery; + } +} + + +interface JQuery { + tooltipster(options?: JQueryTooltipster.ITooltipsterOptions): JQuery|JQueryTooltipster.ITooltipsterInstance[]; +} \ No newline at end of file From 8b5b8b65da3ccc6c418033b2e37d05fd76dde385 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 Sep 2015 15:04:37 +0200 Subject: [PATCH 055/329] updated definitions to include more typing --- tooltipster/tooltipster-tests.ts | 2 +- tooltipster/tooltipster.d.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tooltipster/tooltipster-tests.ts b/tooltipster/tooltipster-tests.ts index 5ca867ec1..0af2cf4f3 100644 --- a/tooltipster/tooltipster-tests.ts +++ b/tooltipster/tooltipster-tests.ts @@ -1,7 +1,7 @@ /// $(function() { - const tooltips = $("#tooltip").tooltipster({ + var tooltips = $("#tooltip").tooltipster({ content: "hi friend!", delay: 300, functionAfter: (origin) => { diff --git a/tooltipster/tooltipster.d.ts b/tooltipster/tooltipster.d.ts index ec1529570..7afa46ddb 100644 --- a/tooltipster/tooltipster.d.ts +++ b/tooltipster/tooltipster.d.ts @@ -74,27 +74,27 @@ declare module JQueryTooltipster { * @param origin * @param content */ - functionInit?: (origin, content) => void; + functionInit?: (origin: JQuery, content: string) => void; /** * Create a custom function to be fired before the tooltip opens. This function may prevent or hold off the opening. * @param origin * @param continueTooltip */ - functionBefore?: (origin, continueTooltip) => void; + functionBefore?: (origin: JQuery, continueTooltip: () => void) => void; /** * Create a custom function to be fired when the tooltip and its contents have been added to the DOM. * @param origin * @param tooltip */ - functionReady?: (origin, tooltip) => void; + functionReady?: (origin: JQuery, tooltip: JQuery) => void; /** * Create a custom function to be fired once the tooltip has been closed and removed from the DOM. * @param origin */ - functionAfter?: (origin) => void; + functionAfter?: (origin: JQuery) => void; /** * If true, the tooltip will close if its origin is clicked. This option only applies when 'trigger' is 'hover' and 'autoClose' is false. Default: false @@ -228,7 +228,7 @@ declare module JQueryTooltipster { * @param value * @returns {} */ - content(value: string); + content(value: string): JQuery; /** * Shows the tooltip. From ed8c24df07472b1ecb305271bc3fc75c9fa8a138 Mon Sep 17 00:00:00 2001 From: Stepan Mikhaylyuk Date: Fri, 11 Sep 2015 18:11:31 +0300 Subject: [PATCH 056/329] force update fix in react we cann pass callback to forceUpdate --- react/react.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/react/react.d.ts b/react/react.d.ts index 906bc9da1..54d13d5eb 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -135,7 +135,7 @@ declare namespace __React { constructor(props?: P, context?: any); setState(f: (prevState: S, props: P) => S, callback?: () => any): void; setState(state: S, callback?: () => any): void; - forceUpdate(): void; + forceUpdate(callBack?: () => any): void; render(): JSX.Element; props: P; state: S; @@ -932,7 +932,7 @@ declare module "react/addons" { constructor(props?: P, context?: any); setState(f: (prevState: S, props: P) => S, callback?: () => any): void; setState(state: S, callback?: () => any): void; - forceUpdate(): void; + forceUpdate(callBack?: () => any): void; render(): JSX.Element; props: P; state: S; From 535bdcd579be3ff7311d374b79dc0ced6dedc0bb Mon Sep 17 00:00:00 2001 From: Joe Skeen Date: Fri, 11 Sep 2015 09:16:33 -0600 Subject: [PATCH 057/329] Fix getSelectedGridRows() for ui-grid --- ui-grid/ui-grid.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index c41cac7c6..05ba92a8c 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -2823,7 +2823,7 @@ 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 From bec5648ef70e2518aa7f9a700a476494de11bded Mon Sep 17 00:00:00 2001 From: kpisaksen Date: Fri, 11 Sep 2015 19:05:59 +0200 Subject: [PATCH 058/329] Include Arrays in use method Express 4.x API reference for app.use includes the use of Arrays. This update adds this to the definition file. --- express/express.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/express/express.d.ts b/express/express.d.ts index b54f6e2fb..2847cd967 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -106,6 +106,8 @@ declare module "express" { use(handler: ErrorRequestHandler): T; use(path: string, ...handler: RequestHandler[]): T; use(path: string, handler: ErrorRequestHandler): T; + use(path: string[], ...handler: RequestHandler[]): T; + use(path: string[], handler: ErrorRequestHandler[]): T; } export function Router(options?: any): Router; From 3f2dc44f7ac9cff93257af8043a7b77292c39321 Mon Sep 17 00:00:00 2001 From: tkqubo Date: Sat, 12 Sep 2015 15:34:36 +0900 Subject: [PATCH 059/329] Add gulp-shell --- gulp-shell/gulp-shell-tests.ts | 42 +++++++++++++++++++++ gulp-shell/gulp-shell.d.ts | 68 ++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 gulp-shell/gulp-shell-tests.ts create mode 100644 gulp-shell/gulp-shell.d.ts diff --git a/gulp-shell/gulp-shell-tests.ts b/gulp-shell/gulp-shell-tests.ts new file mode 100644 index 000000000..eb3d1a5a4 --- /dev/null +++ b/gulp-shell/gulp-shell-tests.ts @@ -0,0 +1,42 @@ +/// +/// + +import shell = require('gulp-shell'); +import gulp = require('gulp'); + +gulp.task('example', function () { + return gulp.src('*.js', {read: false}) + .pipe(shell([ + 'echo <%= f(file.path) %>', + 'ls -l <%= file.path %>' + ], { + templateData: { + f: function (s: string) { + return s.replace(/$/, '.bak') + } + } + })) +}); + +gulp.task('shorthand', shell.task([ + 'echo hello', + 'echo world' +])); + +var paths: any = { + js: ['*.js', 'test/*.js'] +}; + +gulp.task('test', shell.task('mocha -R spec')); + +gulp.task('coverage', ['test'], shell.task('istanbul cover _mocha -- -R spec')); + +gulp.task('coveralls', ['coverage'], shell.task('cat coverage/lcov.info | coveralls')); + +gulp.task('lint', shell.task('eslint ' + paths.js.join(' '))); + +gulp.task('default', ['coverage', 'lint']); + +gulp.task('watch', function () { + gulp.watch(paths.js, ['default']) +}); diff --git a/gulp-shell/gulp-shell.d.ts b/gulp-shell/gulp-shell.d.ts new file mode 100644 index 000000000..d88f27ed6 --- /dev/null +++ b/gulp-shell/gulp-shell.d.ts @@ -0,0 +1,68 @@ +// Type definitions for gulp-shell +// Project: https://github.com/sun-zheng-an/gulp-shell +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "gulp-shell" { + + namespace shell { + interface Shell { + (commands: string|string[], options?: Option): NodeJS.ReadWriteStream; + task(commands: string|string[], options?: Option): () => NodeJS.ReadWriteStream; + } + + interface Option { + /** + * You can add a custom error message for when the command fails. This can be a template which can be + * interpolated with the current command, some file info (e.g. file.path) and some error info + * (e.g. error.code). + * @default 'Command `<%= command %>` failed with exit code <%= error.code %>' + */ + errorMessage?: string; + /** + * By default, it will emit an error event when the command finishes unsuccessfully. + * @default false + */ + ignoreErrors?: boolean; + /** + * By default, it will print the command output. + * @default false + */ + quiet?: boolean; + /** + * Sets the current working directory for the command. + * @default process.cwd() + */ + cwd?: string; + /** + * The data that can be accessed in template. + */ + templateData?: any; + /** + * You won't need to set this option unless you encounter a "stdout maxBuffer exceeded" error. + * @default 16MB(16 * 1024 * 1024) + */ + maxBuffer?: number; + /** + * The maximum amount of time in milliseconds the process is allowed to run. + * @default + */ + timeout?: number; + /** + * By default, all the commands will be executed in an environment with all the variables in process.env + * and PATH prepended by ./node_modules/.bin (allowing you to run executables in your Node's dependencies). + * You can override any environment variables with this option. + * For example, setting it to {PATH: process.env.PATH} will reset the PATH + * if the default one brings your some troubles. + */ + env?: any; + } + } + + var shell: shell.Shell; + + export = shell; +} + From 4b2c1c12689354a218c542143be066bcb53bb218 Mon Sep 17 00:00:00 2001 From: Matti Lehtinen Date: Sat, 12 Sep 2015 14:25:43 +0300 Subject: [PATCH 060/329] Amazon-product-api typings --- .../amazon-product-api-tests.ts | 84 +++++++++++++++++++ amazon-product-api/amazon-product-api.d.ts | 27 ++++++ 2 files changed, 111 insertions(+) create mode 100644 amazon-product-api/amazon-product-api-tests.ts create mode 100644 amazon-product-api/amazon-product-api.d.ts diff --git a/amazon-product-api/amazon-product-api-tests.ts b/amazon-product-api/amazon-product-api-tests.ts new file mode 100644 index 000000000..b98e15710 --- /dev/null +++ b/amazon-product-api/amazon-product-api-tests.ts @@ -0,0 +1,84 @@ +/// +/// + +import amazon = require('amazon-product-api'); + +var client = amazon.createClient({ + awsId: process.env.AWS_ACCESS_KEY_ID, + awsSecret: process.env.AWS_SECRET, + awsTag: process.env.AWS_ASSOCIATE_TAG +}); + + +// Item Search + +var searchQuery = { + director: 'Quentin Tarantino', + actor: 'Samuel L. Jackson', + searchIndex: 'DVD', + audienceRating: 'R', + responseGroup: 'ItemAttributes,Offers,Images' +}; + +client.itemSearch(searchQuery).then((results) => { + console.log(getResultCount(results) + " search results"); +}).catch(function(err){ + console.log(err); +}); + +client.itemSearch(searchQuery, (err, results) => { + if(err) { + console.log(err); + return; + } + console.log(getResultCount(results) + " search results"); +}); + + +// Item Lookup + +var lookupQuery = { + itemId: 'B00008OE6I', + idType: 'ASIN', + responseGroup: 'OfferFull', + Condition: 'All' +}; + +client.itemLookup(lookupQuery).then((results) => { + console.log(getResultCount(results) + " lookup results"); +}).catch(function(err){ + console.log(err); +}); + +client.itemLookup(lookupQuery, (err, results) => { + if(err) { + console.log(err); + return; + } + console.log(getResultCount(results) + " lookup results"); +}); + +// Browse Node Lookup + +var nodeLookupQuery = { + browseNodeId: '2625373011' +}; + +client.browseNodeLookup(nodeLookupQuery).then((results) => { + console.log(getResultCount(results) + " node lookup results"); +}).catch(function(err){ + console.log(err); +}); + +client.browseNodeLookup(nodeLookupQuery, (err, results) => { + if(err) { + console.log(err); + return; + } + + console.log(getResultCount(results) + " node lookup results"); +}); + +function getResultCount(results: Object[]) { + return results != undefined ? results.length : 0; +} \ No newline at end of file diff --git a/amazon-product-api/amazon-product-api.d.ts b/amazon-product-api/amazon-product-api.d.ts new file mode 100644 index 000000000..fc84dcc09 --- /dev/null +++ b/amazon-product-api/amazon-product-api.d.ts @@ -0,0 +1,27 @@ +// Type definitions for amazon-product-api +// Project: https://github.com/t3chnoboy/amazon-product-api +// Definitions by: Matti Lehtinen +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "amazon-product-api" { + + interface ICredentials { + awsId: string, + awsSecret: string, + awsTag: string + } + + interface IAmazonProductQueryCallback { + (err: string, results: Object[]): void; + } + + interface IAmazonProductClient { + itemSearch(query: any, callback?: IAmazonProductQueryCallback) : Promise; + itemLookup(query: any, callback?: IAmazonProductQueryCallback) : Promise; + browseNodeLookup(query: any, callback?: IAmazonProductQueryCallback) : Promise; + } + + export function createClient(credentials:ICredentials) : IAmazonProductClient; +} From bcccc003255c1659f3df9480e045f703bb25db0a Mon Sep 17 00:00:00 2001 From: tkqubo Date: Sun, 13 Sep 2015 06:38:35 +0900 Subject: [PATCH 061/329] Add svg-sprite --- svg-sprite/svg-sprite-tests.ts | 19 ++++++++++++++++++ svg-sprite/svg-sprite.d.ts | 36 ++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 svg-sprite/svg-sprite-tests.ts create mode 100644 svg-sprite/svg-sprite.d.ts diff --git a/svg-sprite/svg-sprite-tests.ts b/svg-sprite/svg-sprite-tests.ts new file mode 100644 index 000000000..2a927998c --- /dev/null +++ b/svg-sprite/svg-sprite-tests.ts @@ -0,0 +1,19 @@ +/// + +import SVGSpriter = require('svg-sprite'); +import * as fs from 'fs'; + +var config: any = null; + +// Create spriter instance (see below for `config` examples) +var spriter = new SVGSpriter(config); + +// Add SVG source files — the manual way ... +spriter.add('assets/svg-1.svg', null, fs.readFileSync('assets/svg-1.svg', {encoding: 'utf-8'})); +spriter.add('assets/svg-2.svg', null, fs.readFileSync('assets/svg-2.svg', {encoding: 'utf-8'})); +/* ... */ + +// Compile the sprite +spriter.compile(function(error: any, result: any) { + /* ... Write `result` files to disk or do whatever with them ... */ +}); diff --git a/svg-sprite/svg-sprite.d.ts b/svg-sprite/svg-sprite.d.ts new file mode 100644 index 000000000..240e14e68 --- /dev/null +++ b/svg-sprite/svg-sprite.d.ts @@ -0,0 +1,36 @@ +// Type definitions for svg-sprite +// Project: https://github.com/jkphl/svg-sprite +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "svg-sprite" { + import File = require('vinyl'); + + namespace sprite { + interface SVGSpriterConstructor { + new(config: any): SVGSpriter; + } + + interface SVGSpriter { + add(file: string|File, name: string, svg: string): SVGSpriter; + compile(config: any, callback: CompileCallback): SVGSpriter; + compile(callback: CompileCallback): void; + getShapes(dest: string, callback: GetShapesCallback): void; + } + + interface CompileCallback { + (error: any, result: any, data: any): any; + } + + interface GetShapesCallback { + (error: any, result: File[]): any; + } + } + + var sprite: sprite.SVGSpriterConstructor; + + export = sprite; +} + From f2be56fd5f2868344bf13928620b0a8de4db0a3f Mon Sep 17 00:00:00 2001 From: tkqubo Date: Sun, 13 Sep 2015 07:01:03 +0900 Subject: [PATCH 062/329] Add svg-spriter's Config and Shape interface --- svg-sprite/svg-sprite.d.ts | 150 +++++++++++++++++++++++++++++++++++-- 1 file changed, 145 insertions(+), 5 deletions(-) diff --git a/svg-sprite/svg-sprite.d.ts b/svg-sprite/svg-sprite.d.ts index 240e14e68..72c8eb1f2 100644 --- a/svg-sprite/svg-sprite.d.ts +++ b/svg-sprite/svg-sprite.d.ts @@ -3,29 +3,169 @@ // Definitions by: Qubo // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// /// +/// +import {LoggerInstance} from "winston"; declare module "svg-sprite" { import File = require('vinyl'); namespace sprite { - interface SVGSpriterConstructor { - new(config: any): SVGSpriter; + interface SVGSpriterConstructor extends NodeJS.EventEmitter { + new(config: Config): SVGSpriter; } interface SVGSpriter { add(file: string|File, name: string, svg: string): SVGSpriter; - compile(config: any, callback: CompileCallback): SVGSpriter; + compile(config: Config, callback: CompileCallback): SVGSpriter; compile(callback: CompileCallback): void; getShapes(dest: string, callback: GetShapesCallback): void; } + interface Config { + /** + * Main output directory + * @default '.' + */ + dest?: string; + /** + * Logging verbosity or custom logger + */ + log?: string|LoggerInstance; + /** + * SVG shape configuration + */ + shape?: Shape; + /** + * Sprite SVG options + */ + svg?: Svg; + /** + * Custom templating variables + */ + variables?: any; + /** + * Output mode configurations + */ + mode?: Mode; + } + + /** + * All settings affecting the SVG shapes of the sprite + */ + interface Shape { + /** + * SVG shape ID related options + */ + id: { + /** + * Separator for directory name traversal + */ + separator: string; + /** + * SVG shape ID generator callback + */ + generator: string|((string) => string); + /** + * File name separator for shape states (e.g. ':hover') + */ + pseudo: string; + /** + * Whitespace replacement for shape IDs + */ + whitespace: string; + }; + /** + * Dimension related options + */ + dimension: { + /** + * Max. shape width + */ + maxWidth: number; + /** + * Max. shape height + */ + maxHeight: number; + /** + * Floating point precision + */ + precision: number; + /** + * Width and height attributes on embedded shapes + */ + attributes: boolean; + }; + /** + * Spacing related options + */ + spacing: { + /** + * Padding around all shapes + */ + padding: number|number[]; + /** + * Padding strategy (similar to CSS `box-sizing`) + */ + box: string; + }; + /** + * List of transformations / optimizations + */ + transform: (string|CustomConfigurationTransform|CustomCallbackTransform)[]; + /** + * Path to YAML file with meta / accessibility data + */ + meta: string; + /** + * Path to YAML file with extended alignment data + */ + align: string; + /** + * Output directory for optimized intermediate SVG shapes + */ + dest: string; + } + + /** + * Pre-defined shape transformation with custom configuration + */ + interface CustomConfigurationTransform { + [transformationName: string]: { + plugins: { [transformationName: string]: boolean }[]; + } + } + + /** + * Custom callback transformation + */ + interface CustomCallbackTransform { + [transformationName: string]: { + /** + * Custom callback transformation + * @param shape SVG shape object + * @param sprite SVG spriter + * @param callback Callback + */ + (shape: any, sprite: SVGSpriter, callback: Function): any; + } + } + + interface Svg { + + } + + interface Mode { + + } + interface CompileCallback { - (error: any, result: any, data: any): any; + (error: Error, result: any, data: any): any; } interface GetShapesCallback { - (error: any, result: File[]): any; + (error: Error, result: File[]): any; } } From c1aad0b41a477cd29475b1a179aebc44282c9930 Mon Sep 17 00:00:00 2001 From: tkqubo Date: Sun, 13 Sep 2015 07:19:09 +0900 Subject: [PATCH 063/329] Add Svg definition to svg-sprite --- svg-sprite/svg-sprite.d.ts | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/svg-sprite/svg-sprite.d.ts b/svg-sprite/svg-sprite.d.ts index 72c8eb1f2..4c441be3c 100644 --- a/svg-sprite/svg-sprite.d.ts +++ b/svg-sprite/svg-sprite.d.ts @@ -12,6 +12,7 @@ declare module "svg-sprite" { import File = require('vinyl'); namespace sprite { + import Function = Stream.Function; interface SVGSpriterConstructor extends NodeJS.EventEmitter { new(config: Config): SVGSpriter; } @@ -153,7 +154,61 @@ declare module "svg-sprite" { } interface Svg { + /** + * Output an XML declaration at the very beginning of each compiled sprite. + * If you provide a non-empty string here, it will be used one-to-one as declaration (e.g. ). + * If you set this to TRUE, *svg-sprite* will look at the registered shapes for an XML declaration and use the first one it can find. + * @default true + */ + xmlDeclaration: boolean|string; + /** + * Include a declaration in each compiled sprite. If you provide a non-empty string here, + * it will be used one-to-one as declaration (e.g. ). + * If you set this to TRUE, *svg-sprite* will look at the registered shapes for a DOCTYPE declaration and use the first one it can find. + * @default true + */ + doctypeDeclaration: boolean|string; + /** + * In order to avoid ID clashes, the default behavior is to namespace all IDs in the source SVGs before compiling them into a sprite. + * Each ID is prepended with a unique string. In some situations, it might be desirable to disable ID namespacing, e.g. when you want to script the resulting sprite. + * Just set svg.namespaceIDs to FALSE then and be aware that you might also want to disable SVGO's ID minification (shape.transform.svgo.plugins: [{cleanupIDs: false}]). + * @default true + */ + namespaceIDs?: boolean; + /** + * In order to avoid CSS class name ambiguities, the default behavior is to namespace CSS class names in the source SVGs before compiling them into a sprite. + * Each class name is prepended with a unique string. Disable this option to keep the class names untouched. + * @default true + */ + namespaceClassnames?: boolean; + /** + * If truthy, width and height attributes will be set on the sprite's element (where applicable). + * @default true + */ + dimensionAttributes?: boolean; + /** + * Shorthand for applying custom attributes to the outermost element. + * Please be aware that certain attributes (e.g. viewBox) will be calculated dynamically and override custom rootAttributes in any case. + */ + rootAttributes?: any; + /** + * Floating point precision for CSS positioning values (defaults to -1 meaning highest possible precision). + */ + precision?: number; + /** + * Callback (or list of callbacks) that will be applied to the resulting SVG sprites as global [post-processing transformation](#svg-sprite-customization). + * transform: Function∣Array + */ + transform?: SvgTransformer|SvgTransformer[]; + } + interface SvgTransformer { + /** + * Custom sprite SVG transformation + * @param svg Sprite SVG + * @return Processed SVG + */ + (svg: string): string; } interface Mode { From 80e2c14a1702dbc82b02fcfd7dd63d0c8855ddf8 Mon Sep 17 00:00:00 2001 From: tkqubo Date: Sun, 13 Sep 2015 07:35:48 +0900 Subject: [PATCH 064/329] Add Mode definition to svg-sprite --- svg-sprite/svg-sprite.d.ts | 99 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/svg-sprite/svg-sprite.d.ts b/svg-sprite/svg-sprite.d.ts index 4c441be3c..77a510bee 100644 --- a/svg-sprite/svg-sprite.d.ts +++ b/svg-sprite/svg-sprite.d.ts @@ -212,7 +212,106 @@ declare module "svg-sprite" { } interface Mode { + css?: CssAndViewSpecificModeConfig|boolean; + view?: CssAndViewSpecificModeConfig|boolean; + defs?: DefsAndSymbolSpecificModeConfig|boolean; + symbol?: DefsAndSymbolSpecificModeConfig|boolean; + stack?: ModeConfig|boolean; + [customConfigName: string]: ModeConfig; + } + interface ModeConfig { + /** + * Base directory for sprite and CSS file output. If not absolute, the path will be resolved using the main output directory (see global dest option). + * @default "" + */ + dest?: string; + /** + * Used for prefixing the [shape ID](#shape-ids) during CSS selector construction. If the value is empty, + * no prefix will be used. The prefix may contain the placeholder "%s" (e.g. ".svg %s-svg"), + * which will then get replaced by the shape ID. Please be aware that "%" is a special character + * in this context and that you'll have to escape it by another percent sign ("%%") in case you want + * to output it to your stylesheets (e.g. for a [Sass placeholder selector](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#placeholder_selectors_)). + * @default ".svg-%s" + */ + prefix?: string; + /** + * A non-empty string value will trigger the creation of additional CSS rules specifying the dimensions of each shape in the sprite. + * The string will be used as suffix to mode..prefix during CSS selector construction and may contain the placeholder "%s", + * which will get replaced by the value of mode..prefix. + * A boolean TRUE will cause the dimensions to be included directly into each shape's CSS rule (only available for «css» and «view» sprites). + * @default "-dims" + */ + dimensions?: string|boolean; + /** + * SVG sprite path and file name, relative to the mode..dest directory. + * You may omit the file extension, in which case it will be set to ".svg" automatically. + * @default "svg/sprite..svg" + */ + sprite?: string; + /** + * Add a content based hash to the name of the sprite file so that clients reliably reload the sprite + * when it's content changes («cache busting»). Defaults to false except for «css» and «view» sprites. + * @default true∣false + */ + bust?: boolean; + /** + * Collection of [stylesheet rendering configurations](#rendering-configurations). + * The keys are used as file extensions as well as file return keys. At present, + * there are default templates for the file extensions css ([CSS](http://www.w3.org/Style/CSS/)), + * scss ([Sass](http://sass-lang.com/)), less ([Less](http://lesscss.org/)) and styl ([Stylus](http://learnboost.github.io/stylus/)), + * which all reside in the directory tmpl/css. Example: {css: true, scss: {dest: '_sprite.scss'}} + * @default {} + */ + render?: { [key: string]: RenderingConfiguration }; + /** + * Enabling this will trigger the creation of an HTML document demoing the usage of the sprite. Please see below for details on [rendering configurations](#rendering-configurations). + * @default false + */ + example?: RenderingConfiguration; + } + + interface RenderingConfiguration { + /** + * HTML document Mustache template + * @default "tmpl//sprite.html" + */ + template?: string; + /** + * HTML document destination + * @default "sprite..html" + */ + dest?: string; + } + + interface CssAndViewSpecificModeConfig extends ModeConfig { + /** + * The arrangement of the shapes within the sprite. Might be "vertical", "horizontal", "diagonal" or "packed" + * (with the latter being the most compact type). It depends on your project which layout is best for you. + * @default "packed" + */ + layout?: string; + /** + * If given and not empty, this will be the selector name of a CSS rule commonly specifying the background-image + * and background-repeat properties for all the shapes in the sprite (thus saving some bytes by not unnecessarily repeating them for each shape) + */ + common?: string; + /** + * If given and not empty, a mixin with this name will be added to supporting output formats (e.g. Sass, LESS, Stylus), + * specifying the background-image and background-repeat properties for all the shapes in the sprite. + * You may use it for creating custom CSS within @media rules. The mixin acts much like the common rule. + * In fact, you can even combine the two - if both are enabled, the common rule will use the mixin internally. + */ + mixin?: string; + } + + interface DefsAndSymbolSpecificModeConfig extends ModeConfig { + /** + * If you want to embed the sprite into your HTML source, you will want to set this to true + * in order to prevent the creation of SVG namespace declarations and to set some other attributes for effectively hiding the library sprite. + * @default false + */ + inline?: boolean; } interface CompileCallback { From 79f74c840234bdb51bbb54f6191bda1ed35bfb21 Mon Sep 17 00:00:00 2001 From: tkqubo Date: Sun, 13 Sep 2015 08:03:31 +0900 Subject: [PATCH 065/329] Add test code --- svg-sprite/svg-sprite-tests.ts | 310 ++++++++++++++++++++++++++++++++- svg-sprite/svg-sprite.d.ts | 78 ++++++--- 2 files changed, 364 insertions(+), 24 deletions(-) diff --git a/svg-sprite/svg-sprite-tests.ts b/svg-sprite/svg-sprite-tests.ts index 2a927998c..74097962f 100644 --- a/svg-sprite/svg-sprite-tests.ts +++ b/svg-sprite/svg-sprite-tests.ts @@ -3,7 +3,12 @@ import SVGSpriter = require('svg-sprite'); import * as fs from 'fs'; -var config: any = null; +var config: SVGSpriter.Config; + + +// +// README.md +// // Create spriter instance (see below for `config` examples) var spriter = new SVGSpriter(config); @@ -17,3 +22,306 @@ spriter.add('assets/svg-2.svg', null, fs.readFileSync('assets/svg-2.svg', {encod spriter.compile(function(error: any, result: any) { /* ... Write `result` files to disk or do whatever with them ... */ }); + +// General configuration options + +config = { + dest : '.', // Main output directory + log : null, // Logging verbosity (default: no logging) + shape : { // SVG shape related options + id : { // SVG shape ID related options + separator : '--', // Separator for directory name traversal + generator : function(svg: string) { /*...*/ return ''; }, // SVG shape ID generator callback + pseudo : '~' // File name separator for shape states (e.g. ':hover') + }, + dimension : { // Dimension related options + maxWidth : 2000, // Max. shape width + maxHeight : 2000, // Max. shape height + precision : 2, // Floating point precision + attributes : false, // Width and height attributes on embedded shapes + }, + spacing : { // Spacing related options + padding : 0, // Padding around all shapes + box : 'content' // Padding strategy (similar to CSS `box-sizing`) + }, + transform : ['svgo'], // List of transformations / optimizations + meta : null, // Path to YAML file with meta / accessibility data + align : null, // Path to YAML file with extended alignment data + dest : null // Output directory for optimized intermediate SVG shapes + }, + svg : { // General options for created SVG files + xmlDeclaration : true, // Add XML declaration to SVG sprite + doctypeDeclaration : true, // Add DOCTYPE declaration to SVG sprite + namespaceIDs : true, // Add namespace token to all IDs in SVG shapes + dimensionAttributes : true // Width and height attributes on the sprite + }, + variables : {} // Custom Mustache templating variables and functions +}; + +// Output modes + +config = { + mode : { + css : true, // Create a «css» sprite + view : true, // Create a «view» sprite + defs : true, // Create a «defs» sprite + symbol : true, // Create a «symbol» sprite + stack : true // Create a «stack» sprite +} +}; + +config = { + mode: { + css: { + // Configuration for the «css» sprite + // ... + } + } +}; + +// Common mode properties + +config = { + mode : { + mode1 : { + dest : "", // Mode specific output directory + prefix : "svg-%s", // Prefix for CSS selectors + dimensions : "-dims", // Suffix for dimension CSS selectors + sprite : "svg/sprite..svg", // Sprite path and name + bust : true, // Cache busting (mode dependent default value) + render : { // Stylesheet rendering definitions + /* ------------------------------------------- + css : false, // CSS stylesheet options + scss : false, // Sass stylesheet options + less : false, // LESS stylesheet options + styl : false // Stylus stylesheet options + : ... // Custom stylesheet options + ------------------------------------------- */ + }, + example : false // Create an HTML example document +} +} +}; + +// Basic examples + +// A.) Standalone sprite + +config = { + mode : { + inline : true, // Prepare for inline embedding + symbol : true // Create a «symbol» sprite +} +}; + +// B.) CSS sprite with Sass resource + +config = { + mode : { + css : { // Create a «css» sprite + render : { + scss : true // Render a Sass stylesheet + } +} +} +}; + +// C.) Multiple sprites + +config = { + mode : { + defs : true, + symbol : true, + stack : true +} +}; + +// D.) No sprite at all + +config = { + shape : { + dest : 'path/to/out/dir' +} +}; + + + +// +// docs/configuration.md +// + +config = { + shape : { + id : { // SVG shape ID related options + separator : '--', // Separator for directory name traversal + generator : function(svg: string) { /*...*/ return ''; }, // SVG shape ID generator callback + pseudo : '~', // File name separator for shape states (e.g. ':hover') + whitespace : '_' // Whitespace replacement for shape IDs + }, + dimension : { // Dimension related options + maxWidth : 2000, // Max. shape width + maxHeight : 2000, // Max. shape height + precision : 2, // Floating point precision + attributes : false, // Width and height attributes on embedded shapes + }, + spacing : { // Spacing related options + padding : 0, // Padding around all shapes + box : 'content' // Padding strategy (similar to CSS `box-sizing`) + }, + transform : ['svgo'], // List of transformations / optimizations + meta : null, // Path to YAML file with meta / accessibility data + align : null, // Path to YAML file with extended alignment data + dest : null // Output directory for optimized intermediate SVG shapes + } +}; + +config = // SVGO transformation with default configuration +{ + shape : { + transform : ['svgo'] + /* ... */ + } +}; + +config = // Equivalent transformation to ['svgo'] +{ + shape : { + transform : [ + {svgo : {}} + ] + /* ... */ + } +}; + +config = // SVGO transformation with custom plugin configuration +{ + shape : { + transform : [ + {svgo : { + plugins : [ + {transformsWithOnePath: true}, + {moveGroupAttrsToElems: false} + ] + }} + ] + /* ... */ + } +}; + +config = // SVGO transformation with custom plugin configuration +{ + shape : { + transform : [ + {custom : + + /** + * Custom callback transformation + * + * @param {SVGShape} shape SVG shape object + * @param {SVGSpriter} spriter SVG spriter + * @param {Function} callback Callback + * @return {void} + */ + function(shape, sprite, callback) { + /* ... */ + callback(null); + } + } + ] + /* ... */ + } +}; + +config = // Custom global post-processing transformation +{ + svg : { + transform : [ + /** + * Custom sprite SVG transformation + * + * @param {String} svg Sprite SVG + * @return {String} Processed SVG + */ + function(svg) { + /* ... */ + return svg; + }, + + /* ... */ + ] + } +}; + +config = { + variables : { + now : +new Date(), + png : function() { + return function(sprite: any, render: any) { + return render(sprite).split('.svg').join('.png'); + } + } + } +}; + +config = // Activate the «css» mode with default configuration +{ + mode : { + css : true + } +}; + +config = // Equivalent: Provide an empty configuration object +{ + mode : { + css : {} + } +}; + +config = // Multiple sprites of the same output mode +{ + mode : { + sprite1 : { + mode : 'css' // Sprite with «css» mode + }, + sprite2 : { + mode : 'css' // Another sprite with «css» mode + } + } +}; + +config = { + mode : { + css : { + example : true + } + } +}; + +config = { + mode : { + css : { + example : {} + } + } +}; + +config = { + mode : { + css : { + render : { + css : { + template : 'path/to/template.html', // relative to current working directory + dest : 'path/to/demo.html' // relative to current output directory + } + } + } + } +}; + +config = { + mode : { + css : { + example : false + } + } +}; diff --git a/svg-sprite/svg-sprite.d.ts b/svg-sprite/svg-sprite.d.ts index 77a510bee..c319fb174 100644 --- a/svg-sprite/svg-sprite.d.ts +++ b/svg-sprite/svg-sprite.d.ts @@ -7,20 +7,48 @@ /// /// -import {LoggerInstance} from "winston"; declare module "svg-sprite" { import File = require('vinyl'); + import winston = require('winston'); namespace sprite { - import Function = Stream.Function; interface SVGSpriterConstructor extends NodeJS.EventEmitter { + /** + * The spriter's constructor (always the entry point) + * @param config Main configuration for the spriting process + */ new(config: Config): SVGSpriter; } interface SVGSpriter { + /** + * Registering source SVG files + * @param file Absolute path to the SVG file or a vinyl file object carrying all the necessary values (the following arguments are ignored then). + * @param name The "local" part of the file path, possibly including subdirectories which will get traversed to CSS selectors using the shape.id.separator configuration option. + * @param svg SVG file content. + */ add(file: string|File, name: string, svg: string): SVGSpriter; + /** + * Registering source SVG files + * @param file Absolute path to the SVG file or a vinyl file object carrying all the necessary values (the following arguments are ignored then). + */ + add(file: File): SVGSpriter; + /** + * Triggering the sprite compilation + * @param config Configuration object setting the output mode parameters for a single compilation run. If omitted, the mode property of the main configuration used for the constructor will be used. + * @param callback Callback triggered when the compilation has finished. + */ compile(config: Config, callback: CompileCallback): SVGSpriter; + /** + * Triggering the sprite compilation + * @param callback Callback triggered when the compilation has finished. + */ compile(callback: CompileCallback): void; + /** + * Accessing the intermediate SVG resources + * @param dest Base directory for the SVG files in case the will be written to disk. + * @param callback Callback triggered when the shapes are available. + */ getShapes(dest: string, callback: GetShapesCallback): void; } @@ -33,7 +61,7 @@ declare module "svg-sprite" { /** * Logging verbosity or custom logger */ - log?: string|LoggerInstance; + log?: string|winston.LoggerInstance; /** * SVG shape configuration */ @@ -59,74 +87,74 @@ declare module "svg-sprite" { /** * SVG shape ID related options */ - id: { + id?: { /** * Separator for directory name traversal */ - separator: string; + separator?: string; /** * SVG shape ID generator callback */ - generator: string|((string) => string); + generator?: string|((svg: string) => string); /** * File name separator for shape states (e.g. ':hover') */ - pseudo: string; + pseudo?: string; /** * Whitespace replacement for shape IDs */ - whitespace: string; + whitespace?: string; }; /** * Dimension related options */ - dimension: { + dimension?: { /** * Max. shape width */ - maxWidth: number; + maxWidth?: number; /** * Max. shape height */ - maxHeight: number; + maxHeight?: number; /** * Floating point precision */ - precision: number; + precision?: number; /** * Width and height attributes on embedded shapes */ - attributes: boolean; + attributes?: boolean; }; /** * Spacing related options */ - spacing: { + spacing?: { /** * Padding around all shapes */ - padding: number|number[]; + padding?: number|number[]; /** * Padding strategy (similar to CSS `box-sizing`) */ - box: string; + box?: string; }; /** * List of transformations / optimizations */ - transform: (string|CustomConfigurationTransform|CustomCallbackTransform)[]; + transform?: (string|CustomConfigurationTransform|CustomCallbackTransform)[]; /** * Path to YAML file with meta / accessibility data */ - meta: string; + meta?: string; /** * Path to YAML file with extended alignment data */ - align: string; + align?: string; /** * Output directory for optimized intermediate SVG shapes */ - dest: string; + dest?: string; } /** @@ -134,7 +162,7 @@ declare module "svg-sprite" { */ interface CustomConfigurationTransform { [transformationName: string]: { - plugins: { [transformationName: string]: boolean }[]; + plugins?: { [transformationName: string]: boolean }[]; } } @@ -160,14 +188,14 @@ declare module "svg-sprite" { * If you set this to TRUE, *svg-sprite* will look at the registered shapes for an XML declaration and use the first one it can find. * @default true */ - xmlDeclaration: boolean|string; + xmlDeclaration?: boolean|string; /** * Include a declaration in each compiled sprite. If you provide a non-empty string here, * it will be used one-to-one as declaration (e.g. ). * If you set this to TRUE, *svg-sprite* will look at the registered shapes for a DOCTYPE declaration and use the first one it can find. * @default true */ - doctypeDeclaration: boolean|string; + doctypeDeclaration?: boolean|string; /** * In order to avoid ID clashes, the default behavior is to namespace all IDs in the source SVGs before compiling them into a sprite. * Each ID is prepended with a unique string. In some situations, it might be desirable to disable ID namespacing, e.g. when you want to script the resulting sprite. @@ -269,6 +297,10 @@ declare module "svg-sprite" { * @default false */ example?: RenderingConfiguration; + /** + * Specify svg-sprite which output mode to use with this configuration + */ + mode?: string; } interface RenderingConfiguration { From 633cd9b7d880c28360d08f4e9686ef8e60d52774 Mon Sep 17 00:00:00 2001 From: pdeva Date: Sat, 12 Sep 2015 16:16:35 -0700 Subject: [PATCH 066/329] Added compose() function declaration --- redux/redux.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/redux/redux.d.ts b/redux/redux.d.ts index 1f33d1559..1bcbedc63 100644 --- a/redux/redux.d.ts +++ b/redux/redux.d.ts @@ -44,8 +44,9 @@ declare module Redux { function bindActionCreators(actionCreators: T, dispatch: Dispatch): T; function combineReducers(reducers: any): Reducer; function applyMiddleware(...middleware: Middleware[]): Function; + function compose(...functions: Function[]): T; } declare module "redux" { export = Redux; -} \ No newline at end of file +} From 69e21d0760b694962fc4240e6d7b18b344aa2036 Mon Sep 17 00:00:00 2001 From: Roman Date: Sun, 13 Sep 2015 15:39:10 +0300 Subject: [PATCH 067/329] node-config support --- node-config/node-config-tests.ts | 28 ++++++++++++++++++++++++++ node-config/node-config.d.ts | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 node-config/node-config-tests.ts create mode 100644 node-config/node-config.d.ts diff --git a/node-config/node-config-tests.ts b/node-config/node-config-tests.ts new file mode 100644 index 000000000..9883a8a21 --- /dev/null +++ b/node-config/node-config-tests.ts @@ -0,0 +1,28 @@ +/// + +import config = require('config'); + +var value: string = config.get(""); +var has: boolean = config.has(""); + +// util tests: +var extended1: any = config.util.extendDeep({}, {}); +var extended2: any = config.util.extendDeep({}, {}, 20); + +var clone1: any = config.util.cloneDeep({}); +var clone2: any = config.util.cloneDeep({}, 20); + +var equals1: boolean = config.util.equalsDeep({}, {}); +var equals2: boolean = config.util.equalsDeep({}, {}, 20); + +var diff1: any = config.util.diffDeep({}, {}); +var diff2: any = config.util.diffDeep({}, {}, 20); + +var immutable1: any = config.util.makeImmutable({}); +var immutable2: any = config.util.makeImmutable({}, ""); +var immutable3: any = config.util.makeImmutable({}, "", ""); + +var hidden1: any = config.util.makeHidden({}, ""); +var hidden2: any = config.util.makeHidden({}, "", ""); + +var env: string = config.util.getEnv(""); diff --git a/node-config/node-config.d.ts b/node-config/node-config.d.ts new file mode 100644 index 000000000..3db296850 --- /dev/null +++ b/node-config/node-config.d.ts @@ -0,0 +1,34 @@ +// Type definitions for node-config +// Project: https://github.com/lorenwest/node-config +// Definitions by: Roman Korneev +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// see https://github.com/lorenwest/node-config/wiki/Using-Config-Utilities +interface IUtil { + // Extend an object (and any object it contains) with one or more objects (and objects contained in them). + extendDeep(mergeInto: any, mergeFrom: any, depth?: number): any; + + // Return a deep copy of the specified object. + cloneDeep(copyFrom: any, depth?: number): any; + + // Return true if two objects have equal contents. + equalsDeep(object1: any, object2: any, dept?: number): boolean; + + // Returns an object containing all elements that differ between two objects. + diffDeep(object1: any, object2: any, depth?: number): any; + + // Make a javascript object property immutable (assuring it cannot be changed from the current value). + makeImmutable(object: any, propertyName?: string, propertyValue?: string): any; + + // Make an object property hidden so it doesn't appear when enumerating elements of the object. + makeHidden(object: any, propertyName: string, propertyValue?: string): any; + + // Get the current value of a config environment variable + getEnv(varName: string): string; +} + +declare module "config" { + export function get(setting: string): any; + export function has(setting: string): boolean; + export var util: IUtil; +} From 280b0abd481387e1ed5f410813b36a407018e67c Mon Sep 17 00:00:00 2001 From: Ben Farr Date: Sun, 13 Sep 2015 17:16:15 +0100 Subject: [PATCH 068/329] Fix table.row.add method table.row.add takes a variable amount of arguments --- mssql/mssql-tests.ts | 14 ++++++++++++++ mssql/mssql.d.ts | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/mssql/mssql-tests.ts b/mssql/mssql-tests.ts index 453b2b4e3..29dcd3421 100644 --- a/mssql/mssql-tests.ts +++ b/mssql/mssql-tests.ts @@ -76,3 +76,17 @@ var connection: sql.Connection = new sql.Connection(config, function (err: any) }); } }); + +function test_table() { + var table = new sql.Table('#temp_table'); + + table.create = true; + + table.columns.add('name', sql.VarChar(sql.MAX), { nullable: false }); + table.columns.add('type', sql.Int, { nullable: false }); + table.columns.add('amount', sql.Decimal(7, 2), { nullable: false }); + + table.rows.add('name', 42, 3.50); + table.rows.add('name2', 7, 3.14); +} + diff --git a/mssql/mssql.d.ts b/mssql/mssql.d.ts index 880eb716c..519a6edeb 100644 --- a/mssql/mssql.d.ts +++ b/mssql/mssql.d.ts @@ -78,7 +78,7 @@ declare module "mssql" { } class rows { - public add(row: any): void; + public add(...row: any[]): void; } export class Table { From ffe1b8a10b0e3445f37684187fdf103c3e143fef Mon Sep 17 00:00:00 2001 From: Ben Farr Date: Sun, 13 Sep 2015 17:42:11 +0100 Subject: [PATCH 069/329] Add missing module variables --- mssql/mssql.d.ts | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/mssql/mssql.d.ts b/mssql/mssql.d.ts index 519a6edeb..7a7d79f6d 100644 --- a/mssql/mssql.d.ts +++ b/mssql/mssql.d.ts @@ -39,15 +39,35 @@ declare module "mssql" { export var Geometry: any; export interface options { + + export var MAX: number; + export var fix: boolean; + export var Promise: any; + + export var map: { js: any, sql: any }[]; + export var DRIVERS: string[]; + + export var ISOLATION_LEVEL: { + READ_UNCOMMITTED: number + READ_COMMITTED: number + REPEATABLE_READ: number + SERIALIZABLE: number + SNAPSHOT: number + } + + export interface IOptions { encrypt: boolean; } - export interface pool { + + export interface IPool { min: number; max: number; idleTimeoutMillis: number; } + export var pool: IPool; + export interface config { driver?: string; user?: string; @@ -59,9 +79,8 @@ declare module "mssql" { connectionTimeout?: number; requestTimeout?: number; stream?: boolean; - options?: options; - pool?: pool; - + options?: IOptions; + pool?: IPool; } export class Connection { From a0e8f7986a0b006aa91289c29e3ac7baf0063f4a Mon Sep 17 00:00:00 2001 From: Imanuel Ulbricht Date: Sun, 13 Sep 2015 21:52:57 +0200 Subject: [PATCH 070/329] Update express.d.ts added baseUrl and app property to express.Request. --- express/express.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/express/express.d.ts b/express/express.d.ts index b54f6e2fb..9fb807e87 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -410,6 +410,10 @@ declare module "express" { originalUrl: string; url: string; + + baseUrl: string; + + app: Application; } interface MediaType { From 3dffe331ad08084d81dee02b7aa727bd0037a9b6 Mon Sep 17 00:00:00 2001 From: Alexander Rusakov Date: Fri, 11 Sep 2015 18:23:51 +0300 Subject: [PATCH 071/329] redux-logger.d.ts --- redux-logger/redux-logger-tests.ts | 19 +++++++++++++++++++ redux-logger/redux-logger.d.ts | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 redux-logger/redux-logger-tests.ts create mode 100644 redux-logger/redux-logger.d.ts diff --git a/redux-logger/redux-logger-tests.ts b/redux-logger/redux-logger-tests.ts new file mode 100644 index 000000000..c57e72177 --- /dev/null +++ b/redux-logger/redux-logger-tests.ts @@ -0,0 +1,19 @@ +/// + +import createLogger from 'redux-logger'; +import { applyMiddleware, createStore } from 'redux' + +let logger = createLogger(); + +let loggerWithOpts = createLogger({ + collapsed: true, + level: 'warn', + logger: console.log, + timestamp: false, + transformer: state => state, + predicate: (getState, action) => true +}); + +let createStoreWithMiddleware = applyMiddleware( + logger, loggerWithOpts +)(createStore); diff --git a/redux-logger/redux-logger.d.ts b/redux-logger/redux-logger.d.ts new file mode 100644 index 000000000..cc014b158 --- /dev/null +++ b/redux-logger/redux-logger.d.ts @@ -0,0 +1,20 @@ +// Type definitions for redux-logger v1.0.6 +// Project: https://github.com/fcomb/redux-logger +// Definitions by: Alexander Rusakov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'redux-logger' { + + interface ReduxLoggerOptions { + collapsed?: boolean; + level?: string; + logger?: any; + timestamp?: boolean; + transformer?: (state:any)=>any, + predicate?: (getState:Function, action:any)=>any + } + + export default function createLogger(options?:ReduxLoggerOptions):Redux.Middleware; +} From 5ac3ef67bac39d4f69abed92450357fd5de1302b Mon Sep 17 00:00:00 2001 From: Ben Farr Date: Sun, 13 Sep 2015 21:36:04 +0100 Subject: [PATCH 072/329] Return Promises Methods return a promises if the callback is omitted. --- mssql/mssql-tests.ts | 23 ++++++++++++++++ mssql/mssql.d.ts | 64 +++++++++++++++++++++++++++----------------- 2 files changed, 63 insertions(+), 24 deletions(-) diff --git a/mssql/mssql-tests.ts b/mssql/mssql-tests.ts index 29dcd3421..d4cf834b0 100644 --- a/mssql/mssql-tests.ts +++ b/mssql/mssql-tests.ts @@ -90,3 +90,26 @@ function test_table() { table.rows.add('name2', 7, 3.14); } + +function test_promise_returns() { + // Methods return a promises if the callback is omitted. + var connection: sql.Connection = new sql.Connection(config); + connection.connect().then(() => { }); + connection.close().then(() => { }); + + var preparedStatment = new sql.PreparedStatement(connection); + preparedStatment.prepare("SELECT @myValue").then(() => { }); + preparedStatment.execute({ myValue: 1 }).then((recordSet) => { }); + preparedStatment.unprepare().then(() => { }); + + var transaction = new sql.Transaction(connection); + transaction.begin().then(() => { }); + transaction.commit().then(() => { }); + transaction.rollback().then(() => { }); + + var request = new sql.Request(); + request.batch('create procedure #temporary as select * from table').then((recordset) => { }); + request.bulk(new sql.Table("table_name")).then(() => { }); + request.query('SELECT 1').then((recordset) => { }); + request.execute('procedure_name').then((recordset) => { }); +} diff --git a/mssql/mssql.d.ts b/mssql/mssql.d.ts index 7a7d79f6d..f5bdd72c5 100644 --- a/mssql/mssql.d.ts +++ b/mssql/mssql.d.ts @@ -3,6 +3,8 @@ // Definitions by: COLSA Corporation // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module "mssql" { export var Date: any; @@ -47,12 +49,15 @@ declare module "mssql" { export var map: { js: any, sql: any }[]; export var DRIVERS: string[]; + type recordSet = any; + type IIsolationLevel = number; + export var ISOLATION_LEVEL: { - READ_UNCOMMITTED: number - READ_COMMITTED: number - REPEATABLE_READ: number - SERIALIZABLE: number - SNAPSHOT: number + READ_UNCOMMITTED: IIsolationLevel + READ_COMMITTED: IIsolationLevel + REPEATABLE_READ: IIsolationLevel + SERIALIZABLE: IIsolationLevel + SNAPSHOT: IIsolationLevel } export interface IOptions { @@ -87,9 +92,11 @@ declare module "mssql" { public constructor(config: config, callback?: (err?: any) => void); - public connect(callback?: (err?: any) => void): void; + public connect(): Promise; + public connect(callback: (err: any) => void): void; - public close(): void; + public close(): Promise; + public close(callback: (err: any) => void): void; } class columns { @@ -110,32 +117,41 @@ declare module "mssql" { export class Request { public constructor(connection?: Connection); - public execute(procedure: string, callback?: (err?: any, recordsets?: any, returnValue?: any) => void): void; - public input(name: string, value: any): void; - public input(name: string, type: any, value: any): void; - public output(name: string, type: any, value?: any): void; public pipe(stream: any): void; - public query(command: string, callback?: (err?: any, recordset?: any) => void): void; - public batch(batch: string, callback?: (err?: any, recordset?: any) => void): void; - public bulk(table: Table, callback?: (err?: any, rowCount?: any) => void): void; - public cancel(): void; - public parameters: any; + execute(procedure: string): Promise; + execute(procedure: string, callback: (err?: any, recordsets?: any, returnValue?: any) => void): void; + input(name: string, value: any): void; + input(name: string, type: any, value: any): void; + output(name: string, type: any, value?: any): void; + query(command: string): Promise; + query(command: string, callback: (err?: any, recordset?: any) => void): void; + batch(batch: string): Promise; + batch(batch: string, callback: (err?: any, recordset?: any) => void): void; + bulk(table: Table): Promise; + bulk(table: Table, callback: (err: any, rowCount: any) => void): void; + cancel(): void; + parameters: any; } export class Transaction { - public constructor(connection?: Connection); - public begin(isolationLevel?: any, callback?: (err?: any) => void): void; - public begin(callback?: (err?: any) => void): void; - public commit(callback?: (err?: any) => void): void; - public rollback(callback?: (err?: any) => void): void; + public constructor(connection: Connection); + public begin(isolationLevel?: IIsolationLevel): Promise; + public begin(isolationLevel?: IIsolationLevel, callback?: (err?: any) => void): void; + public commit(): Promise; + public commit(callback: (err?: any) => void): void; + public rollback(): Promise; + public rollback(callback: (err?: any) => void): void; } export class PreparedStatement { public constructor(connection?: Connection); public input(name: string, type: any): void; public output(name: string, type: any): void; - public prepare(statement: string, callback?: (err?: any) => void): void; - public execute(values: any, callback?: (err?: any) => void): void; - public unprepare(callback?: (err?: any) => void): void; + public prepare(statement?: string): Promise; + public prepare(statement?: string, callback?: (err?: any) => void): void; + public execute(values: Object): Promise; + public execute(values: Object, callback: (err: any, recordSet: recordSet) => void): void; + public unprepare(): Promise; + public unprepare(callback: (err?: any) => void): void; } } From 1ae80ee1efa039bdb58687377da2ccd1792d0846 Mon Sep 17 00:00:00 2001 From: Ben Farr Date: Sun, 13 Sep 2015 21:49:01 +0100 Subject: [PATCH 073/329] Different arguments for new Request Request can be constructed with a connection, preparedStatment, transaction or no arguments --- mssql/mssql-tests.ts | 13 +++++++++++++ mssql/mssql.d.ts | 30 ++++++++++++++++-------------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/mssql/mssql-tests.ts b/mssql/mssql-tests.ts index d4cf834b0..3f4adcd41 100644 --- a/mssql/mssql-tests.ts +++ b/mssql/mssql-tests.ts @@ -113,3 +113,16 @@ function test_promise_returns() { request.query('SELECT 1').then((recordset) => { }); request.execute('procedure_name').then((recordset) => { }); } + + +function test_request_constructor() { + // Request can be constructed with a connection, preparedStatment, transaction or no arguments + var connection: sql.Connection = new sql.Connection(config); + var preparedStatment = new sql.PreparedStatement(connection); + var transaction = new sql.Transaction(connection); + + var request1 = new sql.Request(connection); + var request2 = new sql.Request(preparedStatment); + var request3 = new sql.Request(transaction); + var request4 = new sql.Request(); +} diff --git a/mssql/mssql.d.ts b/mssql/mssql.d.ts index f5bdd72c5..e0e58237c 100644 --- a/mssql/mssql.d.ts +++ b/mssql/mssql.d.ts @@ -117,20 +117,22 @@ declare module "mssql" { export class Request { public constructor(connection?: Connection); - public pipe(stream: any): void; - execute(procedure: string): Promise; - execute(procedure: string, callback: (err?: any, recordsets?: any, returnValue?: any) => void): void; - input(name: string, value: any): void; - input(name: string, type: any, value: any): void; - output(name: string, type: any, value?: any): void; - query(command: string): Promise; - query(command: string, callback: (err?: any, recordset?: any) => void): void; - batch(batch: string): Promise; - batch(batch: string, callback: (err?: any, recordset?: any) => void): void; - bulk(table: Table): Promise; - bulk(table: Table, callback: (err: any, rowCount: any) => void): void; - cancel(): void; - parameters: any; + public constructor(transaction: Transaction); + public constructor(preparedStatement: PreparedStatement); + public execute(procedure: string): Promise; + public execute(procedure: string, callback: (err?: any, recordsets?: any, returnValue?: any) => void): void; + public input(name: string, value: any): void; + public input(name: string, type: any, value: any): void; + public output(name: string, type: any, value?: any): void; + public pipe(stream: NodeJS.WritableStream): void; + public query(command: string): Promise; + public query(command: string, callback: (err?: any, recordset?: any) => void): void; + public batch(batch: string): Promise; + public batch(batch: string, callback: (err?: any, recordset?: any) => void): void; + public bulk(table: Table): Promise; + public bulk(table: Table, callback: (err: any, rowCount: any) => void): void; + public cancel(): void; + public parameters: any; } export class Transaction { From 1368ed3f942f45df7866ad128441716982d2cc34 Mon Sep 17 00:00:00 2001 From: Ben Farr Date: Sun, 13 Sep 2015 22:56:17 +0100 Subject: [PATCH 074/329] Classes extend EventEmitter Classes Connection, Request, Transaction and PreparedStatement all extend Node's EventEmitter --- mssql/mssql-tests.ts | 16 ++++++++++++++++ mssql/mssql.d.ts | 11 +++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/mssql/mssql-tests.ts b/mssql/mssql-tests.ts index 3f4adcd41..6fa546e66 100644 --- a/mssql/mssql-tests.ts +++ b/mssql/mssql-tests.ts @@ -126,3 +126,19 @@ function test_request_constructor() { var request3 = new sql.Request(transaction); var request4 = new sql.Request(); } + +function test_classes_extend_eventemitter() { + var connection: sql.Connection = new sql.Connection(config); + var transaction = new sql.Transaction(); + var request = new sql.Request(); + var preparedStatment = new sql.PreparedStatement(); + + connection.on('connect', () => { }); + transaction.on('begin', () => { }); + transaction.on('commit', () => { }); + transaction.on('rollback', () => { }); + request.on('done', () => { }); + request.on('error', () => { }); + + preparedStatment.on('error', () => { }) +} \ No newline at end of file diff --git a/mssql/mssql.d.ts b/mssql/mssql.d.ts index e0e58237c..4f2ee1ff7 100644 --- a/mssql/mssql.d.ts +++ b/mssql/mssql.d.ts @@ -3,6 +3,7 @@ // Definitions by: COLSA Corporation // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// /// declare module "mssql" { @@ -41,6 +42,8 @@ declare module "mssql" { export var Geometry: any; export interface options { + import events = require('events'); + export var MAX: number; export var fix: boolean; @@ -88,7 +91,7 @@ declare module "mssql" { pool?: IPool; } - export class Connection { + export class Connection extends events.EventEmitter { public constructor(config: config, callback?: (err?: any) => void); @@ -115,7 +118,7 @@ declare module "mssql" { } - export class Request { + export class Request extends events.EventEmitter { public constructor(connection?: Connection); public constructor(transaction: Transaction); public constructor(preparedStatement: PreparedStatement); @@ -135,7 +138,7 @@ declare module "mssql" { public parameters: any; } - export class Transaction { + export class Transaction extends events.EventEmitter { public constructor(connection: Connection); public begin(isolationLevel?: IIsolationLevel): Promise; public begin(isolationLevel?: IIsolationLevel, callback?: (err?: any) => void): void; @@ -145,7 +148,7 @@ declare module "mssql" { public rollback(callback: (err?: any) => void): void; } - export class PreparedStatement { + export class PreparedStatement extends events.EventEmitter { public constructor(connection?: Connection); public input(name: string, type: any): void; public output(name: string, type: any): void; From 8502c06745034846db5a45f46cc4af18268f98fd Mon Sep 17 00:00:00 2001 From: Ben Farr Date: Sun, 13 Sep 2015 23:08:41 +0100 Subject: [PATCH 075/329] Minor fixes --- mssql/mssql.d.ts | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/mssql/mssql.d.ts b/mssql/mssql.d.ts index 4f2ee1ff7..6ad299c77 100644 --- a/mssql/mssql.d.ts +++ b/mssql/mssql.d.ts @@ -7,6 +7,7 @@ /// declare module "mssql" { + import events = require('events'); export var Date: any; export var DateTime: any; @@ -15,22 +16,22 @@ declare module "mssql" { export var SmallDateTime: any; export var Time: any; export var Char: any; - export var VarChar:any; + export var VarChar: any; export var NChar: any; export var NVarChar: any; - export var Text:any; - export var NText:any; + export var Text: any; + export var NText: any; export var Xml: any; - export var TinyInt:any; - export var SmallInt:any; + export var TinyInt: any; + export var SmallInt: any; export var Int: any; - export var BigInt:any; - export var Decimal:any; - export var Float:any; - export var Real:any; - export var SmallMoney:any; - export var Money:any; - export var Numeric:any; + export var BigInt: any; + export var Decimal: any; + export var Float: any; + export var Real: any; + export var SmallMoney: any; + export var Money: any; + export var Numeric: any; export var Bit: any; export var Binary: any; export var VarBinary: any; @@ -41,10 +42,6 @@ declare module "mssql" { export var Geography: any; export var Geometry: any; - export interface options { - import events = require('events'); - - export var MAX: number; export var fix: boolean; export var Promise: any; @@ -92,12 +89,9 @@ declare module "mssql" { } export class Connection extends events.EventEmitter { - public constructor(config: config, callback?: (err?: any) => void); - public connect(): Promise; public connect(callback: (err: any) => void): void; - public close(): Promise; public close(callback: (err: any) => void): void; } @@ -115,7 +109,6 @@ declare module "mssql" { public columns: columns; public rows: rows; public constructor(tableName: string); - } export class Request extends events.EventEmitter { @@ -139,7 +132,7 @@ declare module "mssql" { } export class Transaction extends events.EventEmitter { - public constructor(connection: Connection); + public constructor(connection?: Connection); public begin(isolationLevel?: IIsolationLevel): Promise; public begin(isolationLevel?: IIsolationLevel, callback?: (err?: any) => void): void; public commit(): Promise; From 93820e0d624e929869070834d5708e2d069825c7 Mon Sep 17 00:00:00 2001 From: Ben Farr Date: Sun, 13 Sep 2015 23:09:49 +0100 Subject: [PATCH 076/329] Add version and credit --- mssql/mssql.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mssql/mssql.d.ts b/mssql/mssql.d.ts index 6ad299c77..f19c1fa84 100644 --- a/mssql/mssql.d.ts +++ b/mssql/mssql.d.ts @@ -1,6 +1,6 @@ -// Type definitions for mssql +// Type definitions for mssql v2.2.0 // Project: https://www.npmjs.com/package/mssql -// Definitions by: COLSA Corporation +// Definitions by: COLSA Corporation , Ben Farr // Definitions: https://github.com/borisyankov/DefinitelyTyped /// From ae22764e146cf48ac342a66216ab0a1fb0cc3536 Mon Sep 17 00:00:00 2001 From: Ben Farr Date: Sun, 13 Sep 2015 23:20:15 +0100 Subject: [PATCH 077/329] Define SQL types Also Duplicated in to .TYPES --- mssql/mssql.d.ts | 111 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 79 insertions(+), 32 deletions(-) diff --git a/mssql/mssql.d.ts b/mssql/mssql.d.ts index f19c1fa84..e67bd3028 100644 --- a/mssql/mssql.d.ts +++ b/mssql/mssql.d.ts @@ -9,38 +9,85 @@ declare module "mssql" { import events = require('events'); - export var Date: any; - export var DateTime: any; - export var DateTime2: any; - export var DateTimeOffset: any; - export var SmallDateTime: any; - export var Time: any; - export var Char: any; - export var VarChar: any; - export var NChar: any; - export var NVarChar: any; - export var Text: any; - export var NText: any; - export var Xml: any; - export var TinyInt: any; - export var SmallInt: any; - export var Int: any; - export var BigInt: any; - export var Decimal: any; - export var Float: any; - export var Real: any; - export var SmallMoney: any; - export var Money: any; - export var Numeric: any; - export var Bit: any; - export var Binary: any; - export var VarBinary: any; - export var TVP: any; - export var UniqueIdentifier: any; - export var Image: any; - export var UDT: any; - export var Geography: any; - export var Geometry: any; + type sqlTypeWithNoParams = { type: sqlTypeFactoryWithNoParams } + type sqlTypeWithLength = { type: sqlTypeFactoryWithLength, length: number } + type sqlTypeWithScale = { type: sqlTypeFactoryWithScale, scale: number } + type sqlTypeWithPrecisionScale = { type: sqlTypeFactoryWithPrecisionScale, precision: number, scale: number } + type sqlTypeWithTvpType = { type: sqlTypeFactoryWithTvpType, tvpType: any } + + type sqlTypeFactoryWithNoParams = () => sqlTypeWithNoParams; + type sqlTypeFactoryWithLength = (length?: number) => sqlTypeWithLength; + type sqlTypeFactoryWithScale = (scale?: number) => sqlTypeWithScale; + type sqlTypeFactoryWithPrecisionScale = (precision?: number, scale?: number) => sqlTypeWithPrecisionScale; + type sqlTypeFactoryWithTvpType = (tvpType: any) => sqlTypeWithTvpType; + + export var VarChar: sqlTypeFactoryWithLength; + export var NVarChar: sqlTypeFactoryWithLength; + export var Text: sqlTypeFactoryWithNoParams; + export var Int: sqlTypeFactoryWithNoParams; + export var BigInt: sqlTypeFactoryWithNoParams; + export var TinyInt: sqlTypeFactoryWithNoParams; + export var SmallInt: sqlTypeFactoryWithNoParams; + export var Bit: sqlTypeFactoryWithNoParams; + export var Float: sqlTypeFactoryWithNoParams; + export var Numeric: sqlTypeFactoryWithPrecisionScale; + export var Decimal: sqlTypeFactoryWithPrecisionScale; + export var Real: sqlTypeFactoryWithNoParams; + export var Date: sqlTypeFactoryWithNoParams; + export var DateTime: sqlTypeFactoryWithNoParams; + export var DateTime2: sqlTypeFactoryWithScale; + export var DateTimeOffset: sqlTypeFactoryWithScale; + export var SmallDateTime: sqlTypeFactoryWithNoParams; + export var Time: sqlTypeFactoryWithScale; + export var UniqueIdentifier: sqlTypeFactoryWithNoParams; + export var SmallMoney: sqlTypeFactoryWithNoParams; + export var Money: sqlTypeFactoryWithNoParams; + export var Binary: sqlTypeFactoryWithNoParams; + export var VarBinary: sqlTypeFactoryWithLength; + export var Image: sqlTypeFactoryWithNoParams; + export var Xml: sqlTypeFactoryWithNoParams; + export var Char: sqlTypeFactoryWithLength; + export var NChar: sqlTypeFactoryWithLength; + export var NText: sqlTypeFactoryWithNoParams; + export var TVP: sqlTypeFactoryWithTvpType; + export var UDT: sqlTypeFactoryWithNoParams; + export var Geography: sqlTypeFactoryWithNoParams; + export var Geometry: sqlTypeFactoryWithNoParams; + + export var TYPES: { + VarChar: sqlTypeFactoryWithLength; + NVarChar: sqlTypeFactoryWithLength; + Text: sqlTypeFactoryWithNoParams; + Int: sqlTypeFactoryWithNoParams; + BigInt: sqlTypeFactoryWithNoParams; + TinyInt: sqlTypeFactoryWithNoParams; + SmallInt: sqlTypeFactoryWithNoParams; + Bit: sqlTypeFactoryWithNoParams; + Float: sqlTypeFactoryWithNoParams; + Numeric: sqlTypeFactoryWithPrecisionScale; + Decimal: sqlTypeFactoryWithPrecisionScale; + Real: sqlTypeFactoryWithNoParams; + Date: sqlTypeFactoryWithNoParams; + DateTime: sqlTypeFactoryWithNoParams; + DateTime2: sqlTypeFactoryWithScale; + DateTimeOffset: sqlTypeFactoryWithScale; + SmallDateTime: sqlTypeFactoryWithNoParams; + Time: sqlTypeFactoryWithScale; + UniqueIdentifier: sqlTypeFactoryWithNoParams; + SmallMoney: sqlTypeFactoryWithNoParams; + Money: sqlTypeFactoryWithNoParams; + Binary: sqlTypeFactoryWithNoParams; + VarBinary: sqlTypeFactoryWithLength; + Image: sqlTypeFactoryWithNoParams; + Xml: sqlTypeFactoryWithNoParams; + Char: sqlTypeFactoryWithLength; + NChar: sqlTypeFactoryWithLength; + NText: sqlTypeFactoryWithNoParams; + TVP: sqlTypeFactoryWithTvpType; + UDT: sqlTypeFactoryWithNoParams; + Geography: sqlTypeFactoryWithNoParams; + Geometry: sqlTypeFactoryWithNoParams; + }; export var MAX: number; export var fix: boolean; From bda476885a90e8a7c33e046f6a32b576e244f465 Mon Sep 17 00:00:00 2001 From: Ben Farr Date: Sun, 13 Sep 2015 23:57:56 +0100 Subject: [PATCH 078/329] export Error classes --- mssql/mssql.d.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/mssql/mssql.d.ts b/mssql/mssql.d.ts index e67bd3028..58e039765 100644 --- a/mssql/mssql.d.ts +++ b/mssql/mssql.d.ts @@ -143,6 +143,13 @@ declare module "mssql" { public close(callback: (err: any) => void): void; } + export class ConnectionError implements Error { + constructor(message: string, code?: any) + public name: string; + public message: string; + public code: string; + } + class columns { public add(name: string, type: any, options: any): void; } @@ -178,6 +185,13 @@ declare module "mssql" { public parameters: any; } + export class RequestError implements Error { + constructor(message: string, code?: any) + public name: string; + public message: string; + public code: string; + } + export class Transaction extends events.EventEmitter { public constructor(connection?: Connection); public begin(isolationLevel?: IIsolationLevel): Promise; @@ -188,6 +202,13 @@ declare module "mssql" { public rollback(callback: (err?: any) => void): void; } + export class TransactionError implements Error { + constructor(message: string, code?: any) + public name: string; + public message: string; + public code: string; + } + export class PreparedStatement extends events.EventEmitter { public constructor(connection?: Connection); public input(name: string, type: any): void; @@ -199,4 +220,11 @@ declare module "mssql" { public unprepare(): Promise; public unprepare(callback: (err?: any) => void): void; } + + export class PreparedStatementError implements Error { + constructor(message: string, code?: any) + public name: string; + public message: string; + public code: string; + } } From 8c36347a98e2b9ce06eb05ee2943c74d00d85758 Mon Sep 17 00:00:00 2001 From: Ben Farr Date: Sun, 13 Sep 2015 23:59:24 +0100 Subject: [PATCH 079/329] add register method to property 'map' array --- mssql/mssql.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mssql/mssql.d.ts b/mssql/mssql.d.ts index 58e039765..934d225f4 100644 --- a/mssql/mssql.d.ts +++ b/mssql/mssql.d.ts @@ -93,7 +93,13 @@ declare module "mssql" { export var fix: boolean; export var Promise: any; - export var map: { js: any, sql: any }[]; + + interface IMap extends Array<{js: any, sql: any }> { + register(jstype: any, sql: any): void; + } + + export var map: IMap; + export var DRIVERS: string[]; type recordSet = any; From 2e2fb72c2625d0755b338b230fc01ab9ed663f81 Mon Sep 17 00:00:00 2001 From: Ben Farr Date: Mon, 14 Sep 2015 00:26:18 +0100 Subject: [PATCH 080/329] Add public properties the main classes --- mssql/mssql.d.ts | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/mssql/mssql.d.ts b/mssql/mssql.d.ts index 934d225f4..c434444d3 100644 --- a/mssql/mssql.d.ts +++ b/mssql/mssql.d.ts @@ -142,6 +142,9 @@ declare module "mssql" { } export class Connection extends events.EventEmitter { + public connected: boolean; + public connecting: boolean; + public driver: string; public constructor(config: config, callback?: (err?: any) => void); public connect(): Promise; public connect(callback: (err: any) => void): void; @@ -171,7 +174,28 @@ declare module "mssql" { public constructor(tableName: string); } + interface IRequestParameters { + [name: string]: { + name: string; + type: any; + io: number; + value: any; + length: number; + scale: number; + precision: number; + tvpType: any; + } + } + export class Request extends events.EventEmitter { + public connection: Connection; + public transaction: Transaction; + public pstatement: PreparedStatement; + public parameters: IRequestParameters; + public verbose: boolean; + public multiple: boolean; + public canceled: boolean; + public stream: any; public constructor(connection?: Connection); public constructor(transaction: Transaction); public constructor(preparedStatement: PreparedStatement); @@ -188,7 +212,6 @@ declare module "mssql" { public bulk(table: Table): Promise; public bulk(table: Table, callback: (err: any, rowCount: any) => void): void; public cancel(): void; - public parameters: any; } export class RequestError implements Error { @@ -199,6 +222,8 @@ declare module "mssql" { } export class Transaction extends events.EventEmitter { + public connection: Connection; + public isolationLevel: IIsolationLevel; public constructor(connection?: Connection); public begin(isolationLevel?: IIsolationLevel): Promise; public begin(isolationLevel?: IIsolationLevel, callback?: (err?: any) => void): void; @@ -216,6 +241,13 @@ declare module "mssql" { } export class PreparedStatement extends events.EventEmitter { + public connection: Connection; + public transaction: Transaction; + public prepared: boolean; + public statement: string; + public parameters: IRequestParameters; + public multiple: boolean; + public stream: any; public constructor(connection?: Connection); public input(name: string, type: any): void; public output(name: string, type: any): void; From d6aab9d29989caa9ff4c1d6bc917b53a29364f21 Mon Sep 17 00:00:00 2001 From: Ben Farr Date: Mon, 14 Sep 2015 00:30:50 +0100 Subject: [PATCH 081/329] Add public properties the main classes --- mssql/mssql-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mssql/mssql-tests.ts b/mssql/mssql-tests.ts index 6fa546e66..e508ec354 100644 --- a/mssql/mssql-tests.ts +++ b/mssql/mssql-tests.ts @@ -71,7 +71,7 @@ var connection: sql.Connection = new sql.Connection(config, function (err: any) console.error('Error happened calling Query: ' + err.name + " " + err.message); } else { - console.info(requestStoredProcedureWithOutput.parameters.output.value); + console.info(requestStoredProcedureWithOutput.parameters['output'].value); } }); } From bdaec8221e118399149519fc9f88277de6c0bb9f Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Mon, 14 Sep 2015 04:52:53 +0500 Subject: [PATCH 082/329] redlock: remove forgotten line --- redlock/redlock.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/redlock/redlock.d.ts b/redlock/redlock.d.ts index 4c55f3b62..07760e102 100644 --- a/redlock/redlock.d.ts +++ b/redlock/redlock.d.ts @@ -39,7 +39,6 @@ declare module RedlockTypes { servers: any[]; // array of redis.RedisClient constructor(clients: any[], options?: RedlockOptions); - //new (clients: any[], options?: IRedlockOptions); acquire(resource: string, ttl: number, callback?: NodeifyCallback): Promise; lock(resource: string, ttl: number, callback?: NodeifyCallback): Promise; From b8e30e877593e8e632a858dbce8115527bf99ff4 Mon Sep 17 00:00:00 2001 From: Makis Maropoulos Date: Mon, 14 Sep 2015 09:51:02 +0300 Subject: [PATCH 083/329] Create socket.io.users.d.ts --- socket.io.users/socket.io.users.d.ts | 79 ++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 socket.io.users/socket.io.users.d.ts diff --git a/socket.io.users/socket.io.users.d.ts b/socket.io.users/socket.io.users.d.ts new file mode 100644 index 000000000..f7ee9b2d8 --- /dev/null +++ b/socket.io.users/socket.io.users.d.ts @@ -0,0 +1,79 @@ +// Type definitions for socket.io.users +// Project: https://github.com/nodets/socket.io.users +// Definitions by: Makis Maropoulos +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// +/// +/// + +declare module "socket.io.users" { + import { EventEmitter } from 'events'; + import { Application } from "express"; + import { SessionOptions } from "express-session"; + + var CONNECTION_EVENTS: string[]; + var Middleware: () => (socket: SocketIO.Socket, next: () => any) => void; + var Session: (app: Application, options?: SessionOptions) => void; + + type SocketUserList = { + [namespace: string]: Users; + }; + + class Namespaces { + private static socketUsersList: any; + static attach(namespace: string, socketUsersObj: Users): void; + static get(namespace: string): Users; + } + + class User { + id: string | number; + socket: SocketIO.Socket; + sockets: SocketIO.Socket[]; + rooms: string[]; + ip: string; + remoteAddresses: string[]; + store: any; + attach(socket: SocketIO.Socket): void; + detachSocket(socket: SocketIO.Socket): void; + detach(): void; + join(room: string): boolean; + leave(room: string): void; + leaveAll(): void; + /** same as in, checks if this user is inside a room */ + belong(room: string): boolean; + /** same as belong, checks if this user is inside a room */ + in(room: string): boolean; + set(key: string, value: any, callback?: () => void): void; + get: (key: string) => any; + toString(): string; + emit(...args: any[]): void; + to(room: string): SocketIO.Socket; + } + + + class Users extends EventEmitter { + namespace: string; + users: User[]; + constructor(namespace?: string); + static of(namespace?: string): Users; + takeId: (request: any) => string | number; + create(socket: SocketIO.Socket): User; + getById(id: string | number): User; + get(socket: SocketIO.Socket): User; + list(): User[]; + size(): number; + push(_user: User): void; + add(socket: SocketIO.Socket): User; + indexOf(user: User): number; + remove(user: User): void; + room(room: string): User[]; + in(room: string): User[]; + from(room: string): User[]; + update(user: User): void; + emitAll(...args: any[]): void; + registerSocketEvents(currentUser: User): void; + } + +} From 0572f9e1c2f5a32411c22457c08f08000b6094a0 Mon Sep 17 00:00:00 2001 From: Makis Maropoulos Date: Mon, 14 Sep 2015 09:51:42 +0300 Subject: [PATCH 084/329] Create socket.io.users-tests.ts --- socket.io.users/socket.io.users-tests.ts | 58 ++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 socket.io.users/socket.io.users-tests.ts diff --git a/socket.io.users/socket.io.users-tests.ts b/socket.io.users/socket.io.users-tests.ts new file mode 100644 index 000000000..54a047262 --- /dev/null +++ b/socket.io.users/socket.io.users-tests.ts @@ -0,0 +1,58 @@ +/// +/// +/// +/// +var express = require('express'); +var app = express(); +var httpServer = require('http').createServer(app); +var io = require('socket.io')(httpServer); +import ioUsers = require("socket.io.users"); + + + +ioUsers.Session(app, { + "secret": "socket.io.users secret test", + "resave": true, + "saveUninitialized": true +}); + +io.use(ioUsers.Middleware()); + +var users = ioUsers.Users.of("/"); + + +var userDisconnected = (user: ioUsers.User) => { + console.log(user.get("username") + " has disconnected from all web browser windows or/and tabs"); +} + +var setUsername = (user: ioUsers.User, data: any) => { + console.log(user.ip + ' is for first time visiting our site. He/she wants ' + data.username + ' for username'); + user.set("username", data.username); +} + +var joinRoom = (user: ioUsers.User, roomToJoin: string) => { + console.log(user.get("username") + ' joined to ' + roomToJoin); +} + +var leaveRoom = (user: ioUsers.User, roomToJoin: string) => { + console.log(user.get("username") + ' joined to ' + roomToJoin); +} + +var sendMessage = (user: ioUsers.User, data: any) => { + console.log(user.get("username") + 'send ' + data.content + ' to room: ' + data.room); +} + +users.on('disconnected', userDisconnected); +users.on('set username', setUsername); +users.on('join room', joinRoom); //notify other = user joined room or (GLOBAL) room created. +users.on('leave room', leaveRoom); //notify other = user left room or (GLOBAL) room removed. +users.on("send message", sendMessage); //notify other = receive message. + +httpServer.on('uncaughtException', function(err: any) { + console.log(err); +}) + +var httpPort = 80; +httpServer.listen(httpPort, function() { + console.log("Server is running on " + httpPort); +}); From d4b7e07fa6de575777a0b979b210aad23dd8bec5 Mon Sep 17 00:00:00 2001 From: Roman Date: Mon, 14 Sep 2015 11:43:48 +0300 Subject: [PATCH 085/329] 1. Use generic for the config.get method. 2. Include IUtil definition in the module scope. --- node-config/node-config-tests.ts | 4 ++- node-config/node-config.d.ts | 50 ++++++++++++++++---------------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/node-config/node-config-tests.ts b/node-config/node-config-tests.ts index 9883a8a21..f20ea7f30 100644 --- a/node-config/node-config-tests.ts +++ b/node-config/node-config-tests.ts @@ -2,7 +2,9 @@ import config = require('config'); -var value: string = config.get(""); +var value1: string = config.get(""); +var value2: any = config.get(""); + var has: boolean = config.has(""); // util tests: diff --git a/node-config/node-config.d.ts b/node-config/node-config.d.ts index 3db296850..c37eddae9 100644 --- a/node-config/node-config.d.ts +++ b/node-config/node-config.d.ts @@ -3,32 +3,32 @@ // Definitions by: Roman Korneev // Definitions: https://github.com/borisyankov/DefinitelyTyped -// see https://github.com/lorenwest/node-config/wiki/Using-Config-Utilities -interface IUtil { - // Extend an object (and any object it contains) with one or more objects (and objects contained in them). - extendDeep(mergeInto: any, mergeFrom: any, depth?: number): any; - - // Return a deep copy of the specified object. - cloneDeep(copyFrom: any, depth?: number): any; - - // Return true if two objects have equal contents. - equalsDeep(object1: any, object2: any, dept?: number): boolean; - - // Returns an object containing all elements that differ between two objects. - diffDeep(object1: any, object2: any, depth?: number): any; - - // Make a javascript object property immutable (assuring it cannot be changed from the current value). - makeImmutable(object: any, propertyName?: string, propertyValue?: string): any; - - // Make an object property hidden so it doesn't appear when enumerating elements of the object. - makeHidden(object: any, propertyName: string, propertyValue?: string): any; - - // Get the current value of a config environment variable - getEnv(varName: string): string; -} - declare module "config" { - export function get(setting: string): any; + // see https://github.com/lorenwest/node-config/wiki/Using-Config-Utilities + interface IUtil { + // Extend an object (and any object it contains) with one or more objects (and objects contained in them). + extendDeep(mergeInto: any, mergeFrom: any, depth?: number): any; + + // Return a deep copy of the specified object. + cloneDeep(copyFrom: any, depth?: number): any; + + // Return true if two objects have equal contents. + equalsDeep(object1: any, object2: any, dept?: number): boolean; + + // Returns an object containing all elements that differ between two objects. + diffDeep(object1: any, object2: any, depth?: number): any; + + // Make a javascript object property immutable (assuring it cannot be changed from the current value). + makeImmutable(object: any, propertyName?: string, propertyValue?: string): any; + + // Make an object property hidden so it doesn't appear when enumerating elements of the object. + makeHidden(object: any, propertyName: string, propertyValue?: string): any; + + // Get the current value of a config environment variable + getEnv(varName: string): string; + } + + export function get(setting: string): T; export function has(setting: string): boolean; export var util: IUtil; } From 24253c8064c1b20cfb64196aec5d0aa205b673ad Mon Sep 17 00:00:00 2001 From: Trapulo Date: Mon, 14 Sep 2015 12:07:30 +0200 Subject: [PATCH 086/329] CircularChartData color optional according to documentation, color is optional http://www.chartjs.org/docs/#doughnut-pie-chart --- chartjs/chart.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chartjs/chart.d.ts b/chartjs/chart.d.ts index 9da7245f6..d337d144a 100644 --- a/chartjs/chart.d.ts +++ b/chartjs/chart.d.ts @@ -27,7 +27,7 @@ interface LinearChartData { interface CircularChartData { value: number; - color: string; + color?: string; highlight?: string; label?: string; } From f78e31744c7b3ee8fda8f8b32ddb7d424eab4c8c Mon Sep 17 00:00:00 2001 From: Bas Pennings Date: Mon, 14 Sep 2015 12:49:44 +0200 Subject: [PATCH 087/329] Added missing explicit void return for batch functions --- levelup/levelup.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/levelup/levelup.d.ts b/levelup/levelup.d.ts index bb5af38be..d6f62f184 100644 --- a/levelup/levelup.d.ts +++ b/levelup/levelup.d.ts @@ -22,8 +22,8 @@ interface LevelUp { del(key: any, options ?: { keyEncoding?: string; sync?: boolean }, callback ?: (error: any) => any): void; - batch(array: Batch[], options?: { keyEncoding?: string; valueEncoding?: string; sync?: boolean }, callback?: (error?: any)=>any); - batch(array: Batch[], callback?: (error?: any)=>any); + batch(array: Batch[], options?: { keyEncoding?: string; valueEncoding?: string; sync?: boolean }, callback?: (error?: any)=>any): void; + batch(array: Batch[], callback?: (error?: any)=>any): void; batch():LevelUpChain; isOpen():boolean; isClosed():boolean; From 446099f04a9e37009f4efa7a47da91c7787dd296 Mon Sep 17 00:00:00 2001 From: Roman Date: Mon, 14 Sep 2015 15:10:27 +0300 Subject: [PATCH 088/329] qs definitions --- qs/qs-tests.ts | 9 +++++++++ qs/qs.d.ts | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 qs/qs-tests.ts create mode 100644 qs/qs.d.ts diff --git a/qs/qs-tests.ts b/qs/qs-tests.ts new file mode 100644 index 000000000..04be4f266 --- /dev/null +++ b/qs/qs-tests.ts @@ -0,0 +1,9 @@ +/// + +import qs = require('qs'); + +qs.stringify({ a: 'b' }); +qs.stringify({ a: 'b', c: 'd' }, { delimiter: '&' }); + +qs.parse('a=b'); +qs.parse('a=b&c=d', { delimiter: '&' }); diff --git a/qs/qs.d.ts b/qs/qs.d.ts new file mode 100644 index 000000000..eea44a749 --- /dev/null +++ b/qs/qs.d.ts @@ -0,0 +1,35 @@ +// Type definitions for qs +// Project: https://github.com/hapijs/qs +// Definitions by: Roman Korneev +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module QueryString { + interface IStringifyOptions { + delimiter?: string; + strictNullHandling?: boolean; + skipNulls?: boolean; + encode?: boolean; + filter?: any; + arrayFormat?: any; + indices?: string; + } + + interface IParseOptions { + delimiter?: string; + depth?: number; + arrayLimit?: number; + parseArrays?: boolean; + allowDots?: boolean; + plainObjects?: boolean; + allowPrototypes?: boolean; + parameterLimit?: number; + strictNullHandling?: boolean; + } + + export function stringify(obj: any, options?: IStringifyOptions): string; + export function parse(str: string, options?: IParseOptions): any; +} + +declare module "qs" { + export = QueryString; +} From cc925de312d06d904d6100ed16b4c973afebeb37 Mon Sep 17 00:00:00 2001 From: Roman Date: Mon, 14 Sep 2015 15:16:57 +0300 Subject: [PATCH 089/329] qs definitions --- qs/qs.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qs/qs.d.ts b/qs/qs.d.ts index eea44a749..5889fae49 100644 --- a/qs/qs.d.ts +++ b/qs/qs.d.ts @@ -26,8 +26,8 @@ declare module QueryString { strictNullHandling?: boolean; } - export function stringify(obj: any, options?: IStringifyOptions): string; - export function parse(str: string, options?: IParseOptions): any; + function stringify(obj: any, options?: IStringifyOptions): string; + function parse(str: string, options?: IParseOptions): any; } declare module "qs" { From f4a7e67bf7986e7a22123b9728848517a6585c4d Mon Sep 17 00:00:00 2001 From: Alexander Rusakov Date: Mon, 14 Sep 2015 16:38:25 +0300 Subject: [PATCH 090/329] semicolons --- redux-logger/redux-logger.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redux-logger/redux-logger.d.ts b/redux-logger/redux-logger.d.ts index cc014b158..28b53f3a1 100644 --- a/redux-logger/redux-logger.d.ts +++ b/redux-logger/redux-logger.d.ts @@ -12,8 +12,8 @@ declare module 'redux-logger' { level?: string; logger?: any; timestamp?: boolean; - transformer?: (state:any)=>any, - predicate?: (getState:Function, action:any)=>any + transformer?: (state:any)=>any; + predicate?: (getState:Function, action:any)=>any; } export default function createLogger(options?:ReduxLoggerOptions):Redux.Middleware; From 072ab07618fbb8bee95f416ac3c81ec07381afd4 Mon Sep 17 00:00:00 2001 From: Bas Pennings Date: Mon, 14 Sep 2015 16:05:03 +0200 Subject: [PATCH 091/329] New definition files for level-sublevel --- level-sublevel/level-sublevel-tests.ts | 28 ++++++++++++++++++++++++++ level-sublevel/level-sublevel.d.ts | 24 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 level-sublevel/level-sublevel-tests.ts create mode 100644 level-sublevel/level-sublevel.d.ts diff --git a/level-sublevel/level-sublevel-tests.ts b/level-sublevel/level-sublevel-tests.ts new file mode 100644 index 000000000..9887dd70c --- /dev/null +++ b/level-sublevel/level-sublevel-tests.ts @@ -0,0 +1,28 @@ +/// + +import levelup = require('levelup'); +import sublevel = require('level-sublevel'); + +var db = sublevel(levelup('./tmp/sublevel-example')); +var sub = db.sublevel('stuff'); + +db.put('foo', 'bar', err => {}); + +sub.put('foo', 'bar', err => {}); + +db.pre((ch, add) => { + add({ + key: ''+Date.now(), + value: ch.key, + type: 'put', + prefix: sub + }) +}); + +var sub1 = db.sublevel('SUB_1'); +var sub2 = db.sublevel('SUM_2'); + +sub1.batch([ + { key: 'key', value: 'Value', type: 'put' }, + { key: 'key', value: 'Value', type: 'put', prefix: sub2 } +], err => { if (err) throw err; }); \ No newline at end of file diff --git a/level-sublevel/level-sublevel.d.ts b/level-sublevel/level-sublevel.d.ts new file mode 100644 index 000000000..969ada963 --- /dev/null +++ b/level-sublevel/level-sublevel.d.ts @@ -0,0 +1,24 @@ +// Type definitions for level-sublevel +// Project: https://github.com/dominictarr/level-sublevel +// Definitions by: Bas Pennings +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface Hook { + (ch: any, add: (op: Batch|boolean) => void): void; +} + +interface Batch { + prefix?: Sublevel; +} + +interface Sublevel extends LevelUp { + sublevel(key: string): Sublevel; + pre(hook: Hook): Function; +} + +declare module "level-sublevel" { + function sublevel(levelup: LevelUp): Sublevel; + export = sublevel; +} \ No newline at end of file From d0a264d5fff335375f32d643db5054b03983c3ed Mon Sep 17 00:00:00 2001 From: "Ciuca, Alexandru" Date: Mon, 14 Sep 2015 16:55:47 +0300 Subject: [PATCH 092/329] angularjs - better granularity for filter service parameter types --- angularjs/angular-tests.ts | 16 ++++++++++++++++ angularjs/angular.d.ts | 18 +++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/angularjs/angular-tests.ts b/angularjs/angular-tests.ts index 50e756217..0174a0d61 100644 --- a/angularjs/angular-tests.ts +++ b/angularjs/angular-tests.ts @@ -933,3 +933,19 @@ function NgModelControllerTyping() { }); }; } + +function ngFilterTyping() { + var $filter: angular.IFilterService; + var items: string[]; + + $filter("name")(items, "test"); + $filter("name")(items, {name: "test"}); + $filter("name")(items, (val, index, array) => { + return array; + }); + $filter("name")(items, (val, index, array) => { + return array; + }, (actual, expected) => { + return actual == expected; + }); +} \ No newline at end of file diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index d183167b5..be0b0861a 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -782,7 +782,23 @@ declare module angular { * * @param name Name of the filter function to retrieve */ - (name: string): Function; + (name: string): IFilterFunc; + } + + interface IFilterFunc { + (array: T[], expression: string | IFilterPatternObject | IFilterPredicateFunc, comparator?: IFilterComparatorFunc|boolean): T[]; + } + + interface IFilterPatternObject { + [name: string]: string; + } + + interface IFilterPredicateFunc { + (value: T, index: number, array: T[]): T[]; + } + + interface IFilterComparatorFunc { + (actual: T, expected: T): boolean; } /** From 5ee16d32e4c50575e6ef2ee9e99fedd17d2b7abc Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Mon, 14 Sep 2015 16:22:05 +0200 Subject: [PATCH 093/329] typings for precond library added --- precond/precond-tests.ts | 43 ++++++++++++++++++++++++++++++ precond/precond-tests.ts.tscparams | 1 + precond/precond.d.ts | 17 ++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 precond/precond-tests.ts create mode 100644 precond/precond-tests.ts.tscparams create mode 100644 precond/precond.d.ts diff --git a/precond/precond-tests.ts b/precond/precond-tests.ts new file mode 100644 index 000000000..dc843e99f --- /dev/null +++ b/precond/precond-tests.ts @@ -0,0 +1,43 @@ +/// + +import precond = require('precond'); + +precond.checkArgument(true); +precond.checkArgument(true, "msg"); +precond.checkArgument(true, "%s %s %s", 1, "two"); + +precond.checkState(true); +precond.checkState(true, "msg"); +precond.checkState(true, "%s %s %s", 1, "two"); + +precond.checkIsDef(true); +precond.checkIsDef(true, "msg"); +precond.checkIsDef(true, "%s %s %s", 1, "two"); + +precond.checkIsDefAndNotNull(true); +precond.checkIsDefAndNotNull(true, "msg"); +precond.checkIsDefAndNotNull(true, "%s %s %s", 1, "two"); + +precond.checkIsString(true); +precond.checkIsString(true, "msg"); +precond.checkIsString(true, "%s %s %s", 1, "two"); + +precond.checkIsArray(true); +precond.checkIsArray(true, "msg"); +precond.checkIsArray(true, "%s %s %s", 1, "two"); + +precond.checkIsNumber(true); +precond.checkIsNumber(true, "msg"); +precond.checkIsNumber(true, "%s %s %s", 1, "two"); + +precond.checkIsBoolean(true); +precond.checkIsBoolean(true, "msg"); +precond.checkIsBoolean(true, "%s %s %s", 1, "two"); + +precond.checkIsFunction(true); +precond.checkIsFunction(true, "msg"); +precond.checkIsFunction(true, "%s %s %s", 1, "two"); + +precond.checkIsObject(true); +precond.checkIsObject(true, "msg"); +precond.checkIsObject(true, "%s %s %s", 1, "two"); \ No newline at end of file diff --git a/precond/precond-tests.ts.tscparams b/precond/precond-tests.ts.tscparams new file mode 100644 index 000000000..2988d8fd6 --- /dev/null +++ b/precond/precond-tests.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny --module commonjs \ No newline at end of file diff --git a/precond/precond.d.ts b/precond/precond.d.ts new file mode 100644 index 000000000..ef5362468 --- /dev/null +++ b/precond/precond.d.ts @@ -0,0 +1,17 @@ +// Type definitions for precond 0.2.3 +// Project: https://github.com/MathieuTurcotte/node-precond +// Definitions by: Oliver Schneider +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "precond" { + export function checkArgument(value: any, message?: string, ...formatArgs: any[]): void; + export function checkState(value: any, message?: string, ...formatArgs: any[]): void; + export function checkIsDef(value: any, message?: string, ...formatArgs: any[]): any; + export function checkIsDefAndNotNull(value: any, message?: string, ...formatArgs: any[]): any; + export function checkIsString(value: any, message?: string, ...formatArgs: any[]): any; + export function checkIsArray(value: any, message?: string, ...formatArgs: any[]): any; + export function checkIsNumber(value: any, message?: string, ...formatArgs: any[]): any; + export function checkIsBoolean(value: any, message?: string, ...formatArgs: any[]): any; + export function checkIsFunction(value: any, message?: string, ...formatArgs: any[]): any; + export function checkIsObject(value: any, message?: string, ...formatArgs: any[]): any; +} \ No newline at end of file From ec7f772c2b8393af26b22c999f5bf2601fa9bc00 Mon Sep 17 00:00:00 2001 From: Morris Allison III Date: Mon, 14 Sep 2015 12:50:31 -0400 Subject: [PATCH 094/329] Add the "replace" option to "router.navigate()" See Backbone documentation for the option here: http://backbonejs.org/#Router-navigate --- backbone/backbone.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/backbone/backbone.d.ts b/backbone/backbone.d.ts index 701cc6d9d..f7c5945ad 100644 --- a/backbone/backbone.d.ts +++ b/backbone/backbone.d.ts @@ -19,6 +19,7 @@ declare module Backbone { interface NavigateOptions { trigger?: boolean; + replace?: boolean; } interface RouterOptions { From 2b368d620fdc997bbbf3c7913c19bfa9ce6aa55c Mon Sep 17 00:00:00 2001 From: Stephen Lautier Date: Mon, 14 Sep 2015 21:25:58 +0200 Subject: [PATCH 095/329] Added definitions for jasmine-es6-promise-matchers --- .../jasmine-es6-promise-matchers-tests.ts | 21 +++++++++++ .../jasmine-es6-promise-matchers.d.ts | 36 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 jasmine-es6-promise-matchers/jasmine-es6-promise-matchers-tests.ts create mode 100644 jasmine-es6-promise-matchers/jasmine-es6-promise-matchers.d.ts diff --git a/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers-tests.ts b/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers-tests.ts new file mode 100644 index 000000000..d2917e761 --- /dev/null +++ b/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers-tests.ts @@ -0,0 +1,21 @@ +/// + +describe('specs', () => { + beforeEach(() => { + JasminePromiseMatchers.install + }); + + afterEach(() => { + JasminePromiseMatchers.uninstall + }); + + it('should have correct syntax', (done) => { + var foo = {}; + var bar = {}; + + expect(foo).toBeResolvedWith(bar, done); + expect(foo).toBeRejectedWith(bar, done); + expect(foo).toBeResolved(done); + expect(foo).toBeRejected(done); + }); +}) \ No newline at end of file diff --git a/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers.d.ts b/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers.d.ts new file mode 100644 index 000000000..1735e51bc --- /dev/null +++ b/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers.d.ts @@ -0,0 +1,36 @@ +// Type definitions for jasmine-es6-promise-matchers +// Project: https://github.com/bvaughn/jasmine-es6-promise-matchers +// Definitions by: Stephen Lautier +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module JasminePromiseMatchers { + export function install():void; + export function uninstall():void; +} + +declare module jasmine { + + interface Matchers { + /** + * Verifies that a Promise is (or has been) rejected. + */ + toBeRejected(done?: () => void): boolean; + + /** + * Verifies that a Promise is (or has been) rejected with the specified parameter. + */ + toBeRejectedWith(value: any, done?: () => void): boolean; + + /** + * Verifies that a Promise is (or has been) resolved. + */ + toBeResolved(done?: () => void): boolean; + + /** + * Verifies that a Promise is (or has been) resolved with the specified parameter. + */ + toBeResolvedWith(value: any, done?: () => void): boolean; + } +} \ No newline at end of file From c2dc1fa32ed56f036f881ea9d9a9a2191792c004 Mon Sep 17 00:00:00 2001 From: tkqubo Date: Tue, 15 Sep 2015 05:03:14 +0900 Subject: [PATCH 096/329] Add core-decorators@0.1.5 --- core-decorators/core-decorators-tests.ts | 169 +++++++++++++++++++++++ core-decorators/core-decorators.d.ts | 89 ++++++++++++ 2 files changed, 258 insertions(+) create mode 100644 core-decorators/core-decorators-tests.ts create mode 100644 core-decorators/core-decorators.d.ts diff --git a/core-decorators/core-decorators-tests.ts b/core-decorators/core-decorators-tests.ts new file mode 100644 index 000000000..e4a31432b --- /dev/null +++ b/core-decorators/core-decorators-tests.ts @@ -0,0 +1,169 @@ +/// + +// +// @autobind +// + +import { autobind } from 'core-decorators'; + +class Person { + @autobind + getPerson() { + return this; + } +} + +let person = new Person(); +let getPerson = person.getPerson; + +getPerson() === person; + +// +// @readonly +// + +import { readonly } from 'core-decorators'; + +class Meal { + @readonly + entree: string = 'steak'; +} + +var dinner = new Meal(); +dinner.entree = 'salmon'; + +// +// @override +// + +import { override } from 'core-decorators'; + +class Parent { + speak(first: string, second: string) {} +} + +class Child extends Parent { + @override + speak() {} + // SyntaxError: Child#speak() does not properly override Parent#speak(first, second) +} + +// or + +class Child2 extends Parent { + @override + speaks() {} + // SyntaxError: No descriptor matching Child#speaks() was found on the prototype chain. + // + // Did you mean "speak"? +} + +// +// @deprecate (alias: @deprecated) +// + +import { deprecate, deprecated } from 'core-decorators'; + +class Person2 { + @deprecate + facepalm() {} + + @deprecate('We stopped facepalming') + facepalmHard() {} + + @deprecate('We stopped facepalming', { url: 'http://knowyourmeme.com/memes/facepalm' }) + facepalmHarder() {} +} + +let person2 = new Person2(); + +person2.facepalm(); +// DEPRECATION Person#facepalm: This function will be removed in future versions. + +person2.facepalmHard(); +// DEPRECATION Person#facepalmHard: We stopped facepalming + +person2.facepalmHarder(); +// DEPRECATION Person#facepalmHarder: We stopped facepalming +// +// See http://knowyourmeme.com/memes/facepalm for more details. +// + +// +// @debounce +// + +import { debounce } from 'core-decorators'; + +class Editor { + + content = ''; + + @debounce(500) + updateContent(content: string) { + this.content = content; + } +} + +// +// @suppressWarnings +// + +import { suppressWarnings } from 'core-decorators'; + +class Person3 { + @deprecated + facepalm() {} + + @suppressWarnings + facepalmWithoutWarning() { + this.facepalm(); + } +} + +let person3 = new Person3(); + +person3.facepalmWithoutWarning(); +// no warning is logged + +// +// @nonenumerable +// + +import { nonenumerable } from 'core-decorators'; + +class Meal2 { + entree = 'steak'; + + @nonenumerable + cost: number = 4.44; +} + +var dinner2 = new Meal2(); +for (var key in dinner2) { + key; + // "entree" only, not "cost" +} + +Object.keys(dinner2); +// ["entree"] + +// +// @nonconfigurable +// + +import { nonconfigurable } from 'core-decorators'; + +class Meal3 { + @nonconfigurable + entree: string = 'steak'; +} + +var dinner3 = new Meal3(); + +Object.defineProperty(dinner3, 'entree', { + enumerable: false +}); +// Cannot redefine property: entree + + diff --git a/core-decorators/core-decorators.d.ts b/core-decorators/core-decorators.d.ts new file mode 100644 index 000000000..20ca4cfe8 --- /dev/null +++ b/core-decorators/core-decorators.d.ts @@ -0,0 +1,89 @@ +// Type definitions for core-decorators.js +// Project: https://github.com/jayphelps/core-decorators.js +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "core-decorators" { + export interface ClassDecorator { + (target: TFunction): TFunction|void; + } + + export interface ParameterDecorator { + (target: Object, propertyKey: string|symbol, parameterIndex: number): void; + } + + export interface PropertyDecorator { + (target: Object, propertyKey: string|symbol): void; + } + + export interface MethodDecorator { + (target: Object, propertyKey: string|symbol, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor|void; + } + + export interface PropertyOrMethodDecorator extends MethodDecorator, PropertyDecorator { + (target: Object, propertyKey: string|symbol): void; + } + + export interface Deprecate extends MethodDecorator { + (message?: string, option?: DeprecateOption): MethodDecorator; + } + + export interface DeprecateOption { + url: string; + } + + /** + * Forces invocations of this function to always have this refer to the class instance, + * even if the function is passed around or would otherwise lose its this context. e.g. var fn = context.method; + */ + var autobind: MethodDecorator; + /** + * Marks a property or method as not being writable. + */ + var readonly: PropertyOrMethodDecorator; + /** + * Checks that the marked method indeed overrides a function with the same signature somewhere on the prototype chain. + */ + var override: MethodDecorator; + /** + * Calls console.warn() with a deprecation message. Provide a custom message to override the default one. You can also provide an options hash with a url, for further reading. + */ + var deprecate: Deprecate; + /** + * Calls console.warn() with a deprecation message. Provide a custom message to override the default one. You can also provide an options hash with a url, for further reading. + */ + var deprecated: Deprecate; + /** + * Creates a new debounced function which will be invoked after wait milliseconds since the time it was invoked. Default timeout is 300 ms. + */ + var debounce: (wait: number) => MethodDecorator; + /** + * Suppresses any JavaScript console.warn() call while the decorated function is called. (i.e. on the stack) + */ + var suppressWarnings: MethodDecorator; + /** + * Marks a property or method as not being enumerable. + */ + var nonenumerable: PropertyOrMethodDecorator; + /** + * Marks a property or method as not being writable. + */ + var nonconfigurable: PropertyOrMethodDecorator; + /** + * Initial implementation included, likely slow. WIP. + */ + var memoize: MethodDecorator; + + export { + autobind, + readonly, + override, + deprecate, + deprecated, + debounce, + suppressWarnings, + nonenumerable, + nonconfigurable, + memoize // WIP + }; +} From 097a226abdbdc8049377dcbbee5457b5c5284097 Mon Sep 17 00:00:00 2001 From: tkqubo Date: Tue, 15 Sep 2015 05:05:25 +0900 Subject: [PATCH 097/329] Add version to d.ts comment --- core-decorators/core-decorators.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-decorators/core-decorators.d.ts b/core-decorators/core-decorators.d.ts index 20ca4cfe8..160802fc1 100644 --- a/core-decorators/core-decorators.d.ts +++ b/core-decorators/core-decorators.d.ts @@ -1,4 +1,4 @@ -// Type definitions for core-decorators.js +// Type definitions for core-decorators.js v0.1.5 // Project: https://github.com/jayphelps/core-decorators.js // Definitions by: Qubo // Definitions: https://github.com/borisyankov/DefinitelyTyped From 62a031c2b200b809eb8e442bc20cb1571bb70b31 Mon Sep 17 00:00:00 2001 From: tkqubo Date: Tue, 15 Sep 2015 05:20:11 +0900 Subject: [PATCH 098/329] Comment out all the test code --- core-decorators/core-decorators-tests.ts | 302 +++++++++++------------ 1 file changed, 151 insertions(+), 151 deletions(-) diff --git a/core-decorators/core-decorators-tests.ts b/core-decorators/core-decorators-tests.ts index e4a31432b..7ec80d2f3 100644 --- a/core-decorators/core-decorators-tests.ts +++ b/core-decorators/core-decorators-tests.ts @@ -1,169 +1,169 @@ -/// - +///// // -// @autobind +//// +//// @autobind +//// // - -import { autobind } from 'core-decorators'; - -class Person { - @autobind - getPerson() { - return this; - } -} - -let person = new Person(); -let getPerson = person.getPerson; - -getPerson() === person; - +//import { autobind } from 'core-decorators'; // -// @readonly +//class Person { +// @autobind +// getPerson() { +// return this; +// } +//} // - -import { readonly } from 'core-decorators'; - -class Meal { - @readonly - entree: string = 'steak'; -} - -var dinner = new Meal(); -dinner.entree = 'salmon'; - +//let person = new Person(); +//let getPerson = person.getPerson; // -// @override +//getPerson() === person; // - -import { override } from 'core-decorators'; - -class Parent { - speak(first: string, second: string) {} -} - -class Child extends Parent { - @override - speak() {} - // SyntaxError: Child#speak() does not properly override Parent#speak(first, second) -} - -// or - -class Child2 extends Parent { - @override - speaks() {} - // SyntaxError: No descriptor matching Child#speaks() was found on the prototype chain. - // - // Did you mean "speak"? -} - +//// +//// @readonly +//// // -// @deprecate (alias: @deprecated) +//import { readonly } from 'core-decorators'; // - -import { deprecate, deprecated } from 'core-decorators'; - -class Person2 { - @deprecate - facepalm() {} - - @deprecate('We stopped facepalming') - facepalmHard() {} - - @deprecate('We stopped facepalming', { url: 'http://knowyourmeme.com/memes/facepalm' }) - facepalmHarder() {} -} - -let person2 = new Person2(); - -person2.facepalm(); -// DEPRECATION Person#facepalm: This function will be removed in future versions. - -person2.facepalmHard(); -// DEPRECATION Person#facepalmHard: We stopped facepalming - -person2.facepalmHarder(); -// DEPRECATION Person#facepalmHarder: We stopped facepalming +//class Meal { +// @readonly +// entree: string = 'steak'; +//} // -// See http://knowyourmeme.com/memes/facepalm for more details. +//var dinner = new Meal(); +//dinner.entree = 'salmon'; // - +//// +//// @override +//// // -// @debounce +//import { override } from 'core-decorators'; // - -import { debounce } from 'core-decorators'; - -class Editor { - - content = ''; - - @debounce(500) - updateContent(content: string) { - this.content = content; - } -} - +//class Parent { +// speak(first: string, second: string) {} +//} // -// @suppressWarnings +//class Child extends Parent { +// @override +// speak() {} +// // SyntaxError: Child#speak() does not properly override Parent#speak(first, second) +//} // - -import { suppressWarnings } from 'core-decorators'; - -class Person3 { - @deprecated - facepalm() {} - - @suppressWarnings - facepalmWithoutWarning() { - this.facepalm(); - } -} - -let person3 = new Person3(); - -person3.facepalmWithoutWarning(); -// no warning is logged - +//// or // -// @nonenumerable +//class Child2 extends Parent { +// @override +// speaks() {} +// // SyntaxError: No descriptor matching Child#speaks() was found on the prototype chain. +// // +// // Did you mean "speak"? +//} // - -import { nonenumerable } from 'core-decorators'; - -class Meal2 { - entree = 'steak'; - - @nonenumerable - cost: number = 4.44; -} - -var dinner2 = new Meal2(); -for (var key in dinner2) { - key; - // "entree" only, not "cost" -} - -Object.keys(dinner2); -// ["entree"] - +//// +//// @deprecate (alias: @deprecated) +//// +// +//import { deprecate, deprecated } from 'core-decorators'; +// +//class Person2 { +// @deprecate +// facepalm() {} +// +// @deprecate('We stopped facepalming') +// facepalmHard() {} +// +// @deprecate('We stopped facepalming', { url: 'http://knowyourmeme.com/memes/facepalm' }) +// facepalmHarder() {} +//} +// +//let person2 = new Person2(); +// +//person2.facepalm(); +//// DEPRECATION Person#facepalm: This function will be removed in future versions. +// +//person2.facepalmHard(); +//// DEPRECATION Person#facepalmHard: We stopped facepalming +// +//person2.facepalmHarder(); +//// DEPRECATION Person#facepalmHarder: We stopped facepalming +//// +//// See http://knowyourmeme.com/memes/facepalm for more details. +//// +// +//// +//// @debounce +//// +// +//import { debounce } from 'core-decorators'; +// +//class Editor { +// +// content = ''; +// +// @debounce(500) +// updateContent(content: string) { +// this.content = content; +// } +//} +// +//// +//// @suppressWarnings +//// +// +//import { suppressWarnings } from 'core-decorators'; +// +//class Person3 { +// @deprecated +// facepalm() {} +// +// @suppressWarnings +// facepalmWithoutWarning() { +// this.facepalm(); +// } +//} +// +//let person3 = new Person3(); +// +//person3.facepalmWithoutWarning(); +//// no warning is logged +// +//// +//// @nonenumerable +//// +// +//import { nonenumerable } from 'core-decorators'; +// +//class Meal2 { +// entree = 'steak'; +// +// @nonenumerable +// cost: number = 4.44; +//} +// +//var dinner2 = new Meal2(); +//for (var key in dinner2) { +// key; +// // "entree" only, not "cost" +//} +// +//Object.keys(dinner2); +//// ["entree"] +// +//// +//// @nonconfigurable +//// +// +//import { nonconfigurable } from 'core-decorators'; +// +//class Meal3 { +// @nonconfigurable +// entree: string = 'steak'; +//} +// +//var dinner3 = new Meal3(); +// +//Object.defineProperty(dinner3, 'entree', { +// enumerable: false +//}); +//// Cannot redefine property: entree // -// @nonconfigurable // - -import { nonconfigurable } from 'core-decorators'; - -class Meal3 { - @nonconfigurable - entree: string = 'steak'; -} - -var dinner3 = new Meal3(); - -Object.defineProperty(dinner3, 'entree', { - enumerable: false -}); -// Cannot redefine property: entree - - From 4dcbaa948eb967877f210b49c5b6996465ab63e2 Mon Sep 17 00:00:00 2001 From: tkqubo Date: Tue, 15 Sep 2015 05:23:17 +0900 Subject: [PATCH 099/329] Add tscparams file and uncomment all the test codes --- core-decorators/core-decorators-tests.ts | 302 +++++++++--------- .../core-decorators-tests.ts.tscparams | 1 + 2 files changed, 152 insertions(+), 151 deletions(-) create mode 100644 core-decorators/core-decorators-tests.ts.tscparams diff --git a/core-decorators/core-decorators-tests.ts b/core-decorators/core-decorators-tests.ts index 7ec80d2f3..e4a31432b 100644 --- a/core-decorators/core-decorators-tests.ts +++ b/core-decorators/core-decorators-tests.ts @@ -1,169 +1,169 @@ -///// +/// + // -//// -//// @autobind -//// +// @autobind // -//import { autobind } from 'core-decorators'; + +import { autobind } from 'core-decorators'; + +class Person { + @autobind + getPerson() { + return this; + } +} + +let person = new Person(); +let getPerson = person.getPerson; + +getPerson() === person; + // -//class Person { -// @autobind -// getPerson() { -// return this; -// } -//} +// @readonly // -//let person = new Person(); -//let getPerson = person.getPerson; + +import { readonly } from 'core-decorators'; + +class Meal { + @readonly + entree: string = 'steak'; +} + +var dinner = new Meal(); +dinner.entree = 'salmon'; + // -//getPerson() === person; +// @override // -//// -//// @readonly -//// + +import { override } from 'core-decorators'; + +class Parent { + speak(first: string, second: string) {} +} + +class Child extends Parent { + @override + speak() {} + // SyntaxError: Child#speak() does not properly override Parent#speak(first, second) +} + +// or + +class Child2 extends Parent { + @override + speaks() {} + // SyntaxError: No descriptor matching Child#speaks() was found on the prototype chain. + // + // Did you mean "speak"? +} + // -//import { readonly } from 'core-decorators'; +// @deprecate (alias: @deprecated) // -//class Meal { -// @readonly -// entree: string = 'steak'; -//} + +import { deprecate, deprecated } from 'core-decorators'; + +class Person2 { + @deprecate + facepalm() {} + + @deprecate('We stopped facepalming') + facepalmHard() {} + + @deprecate('We stopped facepalming', { url: 'http://knowyourmeme.com/memes/facepalm' }) + facepalmHarder() {} +} + +let person2 = new Person2(); + +person2.facepalm(); +// DEPRECATION Person#facepalm: This function will be removed in future versions. + +person2.facepalmHard(); +// DEPRECATION Person#facepalmHard: We stopped facepalming + +person2.facepalmHarder(); +// DEPRECATION Person#facepalmHarder: We stopped facepalming // -//var dinner = new Meal(); -//dinner.entree = 'salmon'; +// See http://knowyourmeme.com/memes/facepalm for more details. // -//// -//// @override -//// + // -//import { override } from 'core-decorators'; +// @debounce // -//class Parent { -// speak(first: string, second: string) {} -//} + +import { debounce } from 'core-decorators'; + +class Editor { + + content = ''; + + @debounce(500) + updateContent(content: string) { + this.content = content; + } +} + // -//class Child extends Parent { -// @override -// speak() {} -// // SyntaxError: Child#speak() does not properly override Parent#speak(first, second) -//} +// @suppressWarnings // -//// or + +import { suppressWarnings } from 'core-decorators'; + +class Person3 { + @deprecated + facepalm() {} + + @suppressWarnings + facepalmWithoutWarning() { + this.facepalm(); + } +} + +let person3 = new Person3(); + +person3.facepalmWithoutWarning(); +// no warning is logged + // -//class Child2 extends Parent { -// @override -// speaks() {} -// // SyntaxError: No descriptor matching Child#speaks() was found on the prototype chain. -// // -// // Did you mean "speak"? -//} +// @nonenumerable // -//// -//// @deprecate (alias: @deprecated) -//// -// -//import { deprecate, deprecated } from 'core-decorators'; -// -//class Person2 { -// @deprecate -// facepalm() {} -// -// @deprecate('We stopped facepalming') -// facepalmHard() {} -// -// @deprecate('We stopped facepalming', { url: 'http://knowyourmeme.com/memes/facepalm' }) -// facepalmHarder() {} -//} -// -//let person2 = new Person2(); -// -//person2.facepalm(); -//// DEPRECATION Person#facepalm: This function will be removed in future versions. -// -//person2.facepalmHard(); -//// DEPRECATION Person#facepalmHard: We stopped facepalming -// -//person2.facepalmHarder(); -//// DEPRECATION Person#facepalmHarder: We stopped facepalming -//// -//// See http://knowyourmeme.com/memes/facepalm for more details. -//// -// -//// -//// @debounce -//// -// -//import { debounce } from 'core-decorators'; -// -//class Editor { -// -// content = ''; -// -// @debounce(500) -// updateContent(content: string) { -// this.content = content; -// } -//} -// -//// -//// @suppressWarnings -//// -// -//import { suppressWarnings } from 'core-decorators'; -// -//class Person3 { -// @deprecated -// facepalm() {} -// -// @suppressWarnings -// facepalmWithoutWarning() { -// this.facepalm(); -// } -//} -// -//let person3 = new Person3(); -// -//person3.facepalmWithoutWarning(); -//// no warning is logged -// -//// -//// @nonenumerable -//// -// -//import { nonenumerable } from 'core-decorators'; -// -//class Meal2 { -// entree = 'steak'; -// -// @nonenumerable -// cost: number = 4.44; -//} -// -//var dinner2 = new Meal2(); -//for (var key in dinner2) { -// key; -// // "entree" only, not "cost" -//} -// -//Object.keys(dinner2); -//// ["entree"] -// -//// -//// @nonconfigurable -//// -// -//import { nonconfigurable } from 'core-decorators'; -// -//class Meal3 { -// @nonconfigurable -// entree: string = 'steak'; -//} -// -//var dinner3 = new Meal3(); -// -//Object.defineProperty(dinner3, 'entree', { -// enumerable: false -//}); -//// Cannot redefine property: entree + +import { nonenumerable } from 'core-decorators'; + +class Meal2 { + entree = 'steak'; + + @nonenumerable + cost: number = 4.44; +} + +var dinner2 = new Meal2(); +for (var key in dinner2) { + key; + // "entree" only, not "cost" +} + +Object.keys(dinner2); +// ["entree"] + // +// @nonconfigurable // + +import { nonconfigurable } from 'core-decorators'; + +class Meal3 { + @nonconfigurable + entree: string = 'steak'; +} + +var dinner3 = new Meal3(); + +Object.defineProperty(dinner3, 'entree', { + enumerable: false +}); +// Cannot redefine property: entree + + diff --git a/core-decorators/core-decorators-tests.ts.tscparams b/core-decorators/core-decorators-tests.ts.tscparams new file mode 100644 index 000000000..3f0863ac6 --- /dev/null +++ b/core-decorators/core-decorators-tests.ts.tscparams @@ -0,0 +1 @@ +--experimentalDecorators --noImplicitAny --target ES5 From 30220afd65d394da7664ce231147c136be348c06 Mon Sep 17 00:00:00 2001 From: fredericogalvao Date: Mon, 14 Sep 2015 17:39:43 -0300 Subject: [PATCH 100/329] Adding phonegap-plugin-push definitions. --- .../phonegap-plugin-push-tests.ts | 59 ++++++ .../phonegap-plugin-push.d.ts | 178 ++++++++++++++++++ 2 files changed, 237 insertions(+) create mode 100644 phonegap-plugin-push/phonegap-plugin-push-tests.ts create mode 100644 phonegap-plugin-push/phonegap-plugin-push.d.ts diff --git a/phonegap-plugin-push/phonegap-plugin-push-tests.ts b/phonegap-plugin-push/phonegap-plugin-push-tests.ts new file mode 100644 index 000000000..916a6cf82 --- /dev/null +++ b/phonegap-plugin-push/phonegap-plugin-push-tests.ts @@ -0,0 +1,59 @@ +/// + +function test() { + var options:PhonegapPluginPush.InitOptions = { + android: { + senderID: '123456789', + icon: 'phonegap', + iconColor: 'blue', + sound: true, + vibrate: true, + clearNotifications: false + }, + ios: { + badge: true, + sound: true, + alert: true + }, + windows: {} + }; + var push:PhonegapPluginPush.PushNotification; + + /*from constructor*/ + push = new PushNotification(options); + + push.unregister(() => { + console.log('did unregister'); + }, () => { + console.log('did not unregister'); + }); + + /*from init*/ + push = PushNotification.init(options); + + push.on('registration', (data:PhonegapPluginPush.RegistrationEventResponse) => { + console.log(data.registrationId); + }); + + push.on('notification', (data:PhonegapPluginPush.NotificationEventResponse) => { + console.log(data.message); + console.log(data.title); + console.log(data.count); + console.log(data.sound); + console.log(data.image); + + /*the rest of the additional fields are not 'canon'*/ + console.log(data.additionalData); + console.log(data.additionalData.foreground); + }); + + push.on('error', (e:Error) => { + console.log(e.message); + }); + + push.setApplicationIconBadgeNumber(() => { + console.log('did setApplicationIconBadgeNumber'); + }, () => { + console.log('did not setApplicationIconBadgeNumber'); + }, 1); +} diff --git a/phonegap-plugin-push/phonegap-plugin-push.d.ts b/phonegap-plugin-push/phonegap-plugin-push.d.ts new file mode 100644 index 000000000..e9168a642 --- /dev/null +++ b/phonegap-plugin-push/phonegap-plugin-push.d.ts @@ -0,0 +1,178 @@ +// Type definitions for phonegap-plugin-push +// Project: https://github.com/phonegap/phonegap-plugin-push +// Definitions by: Frederico Galvão +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module PhonegapPluginPush { + type EventResponse = RegistrationEventResponse | NotificationEventResponse | Error + + interface PushNotification { + /** + * The event registration will be triggered on each successful registration with the 3rd party push service. + * @param event + * @param callback + */ + on(event:"registration", callback:(response:RegistrationEventResponse)=>any):void + /** + * The event notification will be triggered each time a push notification is received by a 3rd party push service on the device. + * @param event + * @param callback + */ + on(event:"notification", callback:(response:NotificationEventResponse)=>any):void + /** + * The event error will trigger when an internal error occurs and the cache is aborted. + * @param event + * @param callback + */ + on(event:"error", callback:(response:Error)=>any):void + /*Generic one, needed for the overloads*/ + /** + * + * @param event Name of the event to listen to. See below(above) for all the event names. + * @param callback is called when the event is triggered. + */ + on(event:string, callback:(response:EventResponse)=>any):void + + /** + * The unregister method is used when the application no longer wants to receive push notifications. + * @param successHandler + * @param errorHandler + */ + unregister(successHandler:()=>any, errorHandler?:()=>any):void + /*TODO according to js source code, "errorHandler" is optional, but is "count" also optional? I can't read objetive-C code (can anyone at all? I wonder...)*/ + /** + * Set the badge count visible when the app is not running + * + * The count is an integer indicating what number should show up in the badge. Passing 0 will clear the badge. Each notification event contains a data.count value which can be used to set the badge to correct number. + * @param successHandler + * @param errorHandler + * @param count + */ + setApplicationIconBadgeNumber(successHandler:()=>any, errorHandler:()=>any, count:number):void + } + + /** + * platform specific initialization options. + */ + interface InitOptions { + /** + * Android specific initialization options. + */ + android?: { + /** + * Maps to the project number in the Google Developer Console. + */ + senderID:string + /** + * The name of a drawable resource to use as the small-icon. + */ + icon?:string + /** + * Sets the background color of the small icon. + * Supported Formats - http://developer.android.com/reference/android/graphics/Color.html#parseColor(java.lang.String) + */ + iconColor?:string + /** + * If true it plays the sound specified in the push data or the default system sound. Default is true. + */ + sound?:boolean + /** + * If true the device vibrates on receipt of notification. Default is true. + */ + vibrate?:boolean + /** + * If true the app clears all pending notifications when it is closed. Default is true. + */ + clearNotifications?:boolean + } + + /** + * iOS specific initialization options. + */ + ios?: { + /** + * If true the device shows an alert on receipt of notification. Default is false. + */ + badge?: boolean + /** + * If true the device sets the badge number on receipt of notification. Default is false. + */ + sound?: boolean + /** + * If true the device plays a sound on receipt of notification. Default is false. + */ + alert?: boolean + } + + /** + * Windows specific initialization options. + */ + windows?: { + + } + } + + interface RegistrationEventResponse { + /** + * The registration ID provided by the 3rd party remote push service. + */ + registrationId:string + } + + interface NotificationEventResponse { + /** + * The text of the push message sent from the 3rd party service. + */ + message:string + /** + * The optional title of the push message sent from the 3rd party service. + */ + title?:string + /** + * The number of messages to be displayed in the badge iOS or message count in the notification shade in Android. + * For windows, it represents the value in the badge notification which could be a number or a status glyph. + */ + count:string + /** + * The name of the sound file to be played upon receipt of the notification. + */ + sound:string + /** + * The path of the image file to be displayed in the notification. + */ + image:string + /** + * An optional collection of data sent by the 3rd party push service that does not fit in the above properties. + */ + additionalData: NotificationEventAdditionalData + } + + interface NotificationEventAdditionalData { + /** + * TODO: document all possible properties (I only got the android ones) + * + * Loosened up with a dictionary notation, but all non-defined properties need to use (map['prop']) notation + * + * Ideally the developer would overload (merged declaration) this or create a new interface that would extend this one + * so that he could specify any custom code without having to use array notation (map['prop']) for all of them. + */ + [name: string]: any + /** + * Whether the notification was received while the app was in the foreground + */ + foreground?:boolean + collapse_key?:string + from?:string + notId?:string + } + + interface PushNotificationStatic { + init(options:InitOptions):PushNotification + new(options:InitOptions):PushNotification + } +} + +interface Window { + PushNotification:PhonegapPluginPush.PushNotificationStatic +} +declare var PushNotification:PhonegapPluginPush.PushNotificationStatic; From cfc40da29bebbe9adfc83c918dee9b4522ef3e16 Mon Sep 17 00:00:00 2001 From: tkqubo Date: Tue, 15 Sep 2015 05:41:40 +0900 Subject: [PATCH 101/329] Add react-props-decorators@0.1.0 --- .../react-props-decorators-tests.ts | 17 ++++++++++++++ .../react-props-decorators-tests.ts.tscparams | 1 + .../react-props-decorators.d.ts | 23 +++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 react-props-decorators/react-props-decorators-tests.ts create mode 100644 react-props-decorators/react-props-decorators-tests.ts.tscparams create mode 100644 react-props-decorators/react-props-decorators.d.ts diff --git a/react-props-decorators/react-props-decorators-tests.ts b/react-props-decorators/react-props-decorators-tests.ts new file mode 100644 index 000000000..6ba9b7cef --- /dev/null +++ b/react-props-decorators/react-props-decorators-tests.ts @@ -0,0 +1,17 @@ +/// +/// + +import React from 'react'; +import { propTypes, defaultProps } from 'react-props-decorators'; + +@propTypes({ + foo: React.PropTypes.string, + bar: React.PropTypes.number +}) +@defaultProps({ + foo: "defaultString", + bar: 100 +}) +class Baz extends React.Component { + /* ... */ +} diff --git a/react-props-decorators/react-props-decorators-tests.ts.tscparams b/react-props-decorators/react-props-decorators-tests.ts.tscparams new file mode 100644 index 000000000..3f0863ac6 --- /dev/null +++ b/react-props-decorators/react-props-decorators-tests.ts.tscparams @@ -0,0 +1 @@ +--experimentalDecorators --noImplicitAny --target ES5 diff --git a/react-props-decorators/react-props-decorators.d.ts b/react-props-decorators/react-props-decorators.d.ts new file mode 100644 index 000000000..98edc9884 --- /dev/null +++ b/react-props-decorators/react-props-decorators.d.ts @@ -0,0 +1,23 @@ +// Type definitions for react-props-decorators +// Project: https://github.com/popkirby/react-props-decorators +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "react-props-decorators" { + import * as React from 'react'; + + export interface ClassDecorator { + (target:TFunction): TFunction|void; + } + + var propTypes: (map: React.ValidationMap) => ClassDecorator; + var defaultProps: (defaultProps: any) => ClassDecorator; + + export { + propTypes, + defaultProps + } +} + From 9718a35bba88f7b34627a9f41a1794c342f039cd Mon Sep 17 00:00:00 2001 From: tkqubo Date: Tue, 15 Sep 2015 05:48:18 +0900 Subject: [PATCH 102/329] Fix bug --- react-props-decorators/react-props-decorators-tests.ts | 4 ++-- react-props-decorators/react-props-decorators.d.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/react-props-decorators/react-props-decorators-tests.ts b/react-props-decorators/react-props-decorators-tests.ts index 6ba9b7cef..33691834c 100644 --- a/react-props-decorators/react-props-decorators-tests.ts +++ b/react-props-decorators/react-props-decorators-tests.ts @@ -1,7 +1,7 @@ /// /// -import React from 'react'; +import * as React from 'react'; import { propTypes, defaultProps } from 'react-props-decorators'; @propTypes({ @@ -12,6 +12,6 @@ import { propTypes, defaultProps } from 'react-props-decorators'; foo: "defaultString", bar: 100 }) -class Baz extends React.Component { +class Baz extends React.Component { /* ... */ } diff --git a/react-props-decorators/react-props-decorators.d.ts b/react-props-decorators/react-props-decorators.d.ts index 98edc9884..9b62d84f9 100644 --- a/react-props-decorators/react-props-decorators.d.ts +++ b/react-props-decorators/react-props-decorators.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-props-decorators +// Type definitions for react-props-decorators 0.1.0 // Project: https://github.com/popkirby/react-props-decorators // Definitions by: Qubo // Definitions: https://github.com/borisyankov/DefinitelyTyped From 1129c4a2c4fb0a5c4b359531bbd6d0ec24faf4fa Mon Sep 17 00:00:00 2001 From: mathieudugal Date: Mon, 14 Sep 2015 19:03:13 -0400 Subject: [PATCH 103/329] Add types descriptions for module ol.geom --- openlayers/openlayers.d.ts | 614 ++++++++++++++++++++++++++++++++++++- 1 file changed, 599 insertions(+), 15 deletions(-) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index 5aba19b54..89680ac91 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -2733,12 +2733,41 @@ declare module ol { } module geom { - + // Type definitions interface GeometryLayout extends String { } interface GeometryType extends String { } + + /** + * Abstract base class; only used for creating subclasses; do not instantiate + * in apps, as cannot be rendered. + */ + class Circle extends ol.geom.SimpleGeometry { - class Circle { + /** + * Test if the geometry and the passed extent intersect. + * @param extent Extent + * @returns true if the geometry and the extent intersect. + */ + intersectsExtent(extent: ol.Extent): boolean; + + /** + * Transform each coordinate of the circle from one coordinate reference system + * to another. The geometry is modified in place. + * If you do not want the geometry modified in place, first clone() it and + * then use this function on the clone. + * + * Internally a circle is currently represented by two points: the center of + * the circle `[cx, cy]`, and the point to the right of the circle + * `[cx + r, cy]`. This `transform` function just transforms these two points. + * So the resulting geometry is also a circle, and that circle does not + * correspond to the shape that would be obtained by transforming every point + * of the original circle. + * @param source The current projection. Can be a string identifier or a {@link ol.proj.Projection} object. + * @param destination The desired projection. Can be a string identifier or a {@link ol.proj.Projection} object. + * @returns This geometry. Note that original geometry is modified in place. + */ + transform(source: ol.proj.ProjectionLike, destination: ol.proj.ProjectionLike): ol.geom.Circle; } /** @@ -2762,35 +2791,590 @@ declare module ol { getExtent(extent?: ol.Extent): ol.Extent; } - class GeometryCollection { + /** + * An array of ol.geom.Geometry objects. + */ + class GeometryCollection extends ol.geom.Geometry { + + /** + * constructor + * @param geometries Geometries. + */ + constructor(geometries?: Array); + + /** + * Apply a transform function to each coordinate of the geometry. The geometry is modified in place. + * If you do not want the geometry modified in place, first clone() it and then use this function on the clone. + * @param transformFn TransformFunction + */ + applyTransform(transformFn: ol.TransformFunction): void; + + /** + * Make a complete copy of the geometry. + * @returns Clone. + */ + clone(): ol.geom.GeometryCollection; + + /** + * Return the geometries that make up this geometry collection. + * @returns Geometries. + */ + getGeometries(): Array; + + /** + * Get the type of this geometry. + * @returns Geometry type + */ + getType(): ol.geom.GeometryType; + + /** + * Test if the geometry and the passed extent intersect. + * @param extent Extent + * @returns true if the geometry and the extent intersect. + */ + intersectsExtent(extent: ol.Extent): boolean; + + /** + * Set the geometries that make up this geometry collection. + * @param geometries Geometries. + */ + setGeometries(geometries: Array): void; + } - class LinearRing { + /** + * Linear ring geometry. Only used as part of polygon; cannot be rendered + * on its own. + */ + class LinearRing extends SimpleGeometry { + + /** + * constructor + * @param coordinates Coordinates. + * @param layout Layout. + */ + constructor(coordinates: Array, layout?: ol.geom.GeometryLayout); + + /** + * Make a complete copy of the geometry. + * @returns Clone. + */ + clone(): ol.geom.LinearRing; + + /** + * Return the area of the linear ring on projected plane. + * @returns Area (on projected plane). + */ + getArea(): number; + + /** + * Return the coordinates of the linear ring. + * @returns Coordinates. + */ + getCoordinates(): Array; + + /** + * Get the type of this geometry. + * @returns Geometry type + */ + getType(): ol.geom.GeometryType; + + /** + * @Set the coordinates of the linear ring + * @param coordinates Coordinates. + * @param layout Layout. + */ + setCoordinates(coordinates: Array, layout?: any): void; + } - class LineString { - new(): LineString; + /** + * Linestring geometry. + */ + class LineString extends ol.geom.SimpleGeometry { + + /** + * constructor + * @param coordinates Coordinates. + * @param layout Layout. + */ + constructor(coordinates: Array, layout?: ol.geom.GeometryLayout); + + /** + * Append the passed coordinate to the coordinates of the linestring. + * @param coordinate Coordinate. + */ + appendCoordinate(coordinate: ol.Coordinate): void; + + /** + * Make a complete copy of the geometry. + * @returns Clone. + */ + clone(): ol.geom.LineString; + + /** + * Returns the coordinate at `m` using linear interpolation, or `null` if no + * such coordinate exists. + * + * `extrapolate` controls extrapolation beyond the range of Ms in the + * MultiLineString. If `extrapolate` is `true` then Ms less than the first + * M will return the first coordinate and Ms greater than the last M will + * return the last coordinate. + * + * @param m M. + * @param extrapolate Extrapolate. Default is `false`. + * @returns Coordinate. + */ + getCoordinateAtM(m: number, extrapolate?: boolean): ol.Coordinate; + + /** + * Return the coordinates of the linestring. + * @returns Coordinates. + */ + getCoordinates(): Array; + + /** + * Return the length of the linestring on projected plane. + * @returns Length (on projected plane). + */ + getLength(): number; + + /** + * Get the type of this geometry. + * @returns Geometry type + */ + getType(): ol.geom.GeometryType; + + /** + * Test if the geometry and the passed extent intersect. + * @param extent Extent + * @returns true if the geometry and the extent intersect. + */ + intersectsExtent(extent: ol.Extent): boolean; + + /** + * Set the coordinates of the linestring. + * @param coordinates Coordinates. + * @param layout Layout. + */ + setCoordinates(coordinates: Array, layout?: ol.geom.GeometryLayout) : void; } - class MultiLineString { + /** + * Multi-linestring geometry. + */ + class MultiLineString extends ol.geom.SimpleGeometry { + + /** + * constructor + * @param coordinates Coordinates. + * @param layout Layout. + */ + constructor(coordinates: Array>, layout?: ol.geom.GeometryLayout); + + /** + * Append the passed linestring to the multilinestring. + * @param lineString LineString. + */ + appendLineString(lineString: ol.geom.LineString): void; + + /** + * Make a complete copy of the geometry. + * @returns Clone. + */ + clone(): ol.geom.MultiLineString; + + /** + * Returns the coordinate at `m` using linear interpolation, or `null` if no + * such coordinate exists. + * + * `extrapolate` controls extrapolation beyond the range of Ms in the + * MultiLineString. If `extrapolate` is `true` then Ms less than the first + * M will return the first coordinate and Ms greater than the last M will + * return the last coordinate. + * + * `interpolate` controls interpolation between consecutive LineStrings + * within the MultiLineString. If `interpolate` is `true` the coordinates + * will be linearly interpolated between the last coordinate of one LineString + * and the first coordinate of the next LineString. If `interpolate` is + * `false` then the function will return `null` for Ms falling between + * LineStrings. + * + * @param m M. + * @param extrapolate Extrapolate. Default is `false`. + * @param interpolate Interpolate. Default is `false`. + * @returns Coordinate. + */ + getCoordinateAtM(m: number, extrapolate?: boolean, interpolate?: boolean): ol.Coordinate; + + /** + * Return the coordinates of the multilinestring. + * @returns Coordinates. + */ + getCoordinates(): Array>; + + /** + * Return the linestring at the specified index. + * @param index Index. + * @returns LineString. + */ + getLineString(index: number): ol.geom.LineString; + + /** + * Return the linestrings of this multilinestring. + * @returns LineStrings. + */ + getLineStrings(): Array; + + /** + * Get the type of this geometry. + * @returns Geometry type + */ + getType(): ol.geom.GeometryType; + + /** + * Test if the geometry and the passed extent intersect. + * @param extent Extent + * @returns true if the geometry and the extent intersect. + */ + intersectsExtent(extent: ol.Extent): boolean; + + /** + * Set the coordinates of the multilinestring. + * @param coordinates Coordinates. + * @param layout Layout. + */ + setCoordinates(coordinates: Array>, layout?: ol.geom.GeometryLayout): void; } - class MultiPoint { + /** + * Multi-point geometry. + */ + class MultiPoint extends ol.geom.SimpleGeometry { + + /** + * constructor + * @param coordinates Coordinates. + * @param layout Layout. + */ + constructor(coordinates: Array, layout?: ol.geom.GeometryLayout); + + /** + * Append the passed point to this multipoint. + * @param {ol.geom.Point} point Point. + */ + appendPoint(point: ol.geom.Point): void; + + /** + * Make a complete copy of the geometry. + * @returns Clone. + */ + clone(): ol.geom.MultiPoint; + + /** + * Return the coordinates of the multipoint. + * @returns Coordinates. + */ + getCoordinates(): Array; + + /** + * Return the point at the specified index. + * @param index Index. + * @returns Point. + */ + getPoint(index: number): ol.geom.Point; + + /** + * Return the points of this multipoint. + * @returns Points. + */ + getPoints(): Array; + + /** + * Get the type of this geometry. + * @returns Geometry type + */ + getType(): ol.geom.GeometryType; + + /** + * Test if the geometry and the passed extent intersect. + * @param extent Extent + * @returns true if the geometry and the extent intersect. + */ + intersectsExtent(extent: ol.Extent): boolean; + + /** + * Set the coordinates of the multipoint. + * @param coordinates Coordinates. + * @param layout Layout. + */ + setCoordinates(coordinates: Array, layout?: ol.geom.GeometryLayout): void; } + + /** + * Multi-polygon geometry. + */ + class MultiPolygon extends ol.geom.SimpleGeometry { + + /** + * constructor + * @param coordinates Coordinates. + * @param layout Layout. + */ + constructor(coordinates: Array>>, layout?: ol.geom.GeometryLayout); + + /** + * Append the passed polygon to this multipolygon. + * @param polygon Polygon. + */ + appendPolygon(polygon: ol.geom.Polygon): void; + + /** + * Make a complete copy of the geometry. + * @returns Clone. + */ + clone(): ol.geom.MultiPolygon; + + /** + * Return the area of the multipolygon on projected plane. + * @returns Area (on projected plane). + */ + getArea(): number; + + /** + * Get the coordinate array for this geometry. This array has the structure + * of a GeoJSON coordinate array for multi-polygons. + * + * @param right Orient coordinates according to the right-hand + * rule (counter-clockwise for exterior and clockwise for interior rings). + * If `false`, coordinates will be oriented according to the left-hand rule + * (clockwise for exterior and counter-clockwise for interior rings). + * By default, coordinate orientation will depend on how the geometry was + * constructed. + * @returns Coordinates. + */ + getCoordinates(right?: boolean): Array>>; + + /** + * Return the interior points as {@link ol.geom.MultiPoint multipoint}. + * @returns Interior points. + */ + getInteriorPoints(): ol.geom.MultiPoint; + + /** + * Return the polygon at the specified index. + * @param index Index. + * @returns Polygon. + */ + getPolygon(index: number): ol.geom.Polygon; + + /** + * Return the polygons of this multipolygon. + * @returns Polygons. + */ + getPolygons(): Array; + + /** + * Get the type of this geometry. + * @returns Geometry type + */ + getType(): ol.geom.GeometryType; + + /** + * Test if the geometry and the passed extent intersect. + * @param extent Extent + * @returns true if the geometry and the extent intersect. + */ + intersectsExtent(extent: ol.Extent): boolean; - class MultiPolygon { + /** + * Set the coordinates of the multipolygon. + * @param coordinates Coordinates. + * @param layout Layout. + */ + setCoordinates(coordinates: Array>>, layout?: ol.geom.GeometryLayout): void; } + /** + * Point geometry. + */ class Point extends SimpleGeometry { - constructor(coordinates: ol.Coordinate, layout?: geom.GeometryLayout); - getCoordinates(): ol.Coordinate; - setCoordinates(coordinates: ol.Coordinate, opt?: geom.GeometryLayout): void; + + /** + * constructor + * @param coordinates Coordinates. + * @param layout Layout. + */ + constructor(coordinates: ol.Coordinate, layout?: ol.geom.GeometryLayout); + + /** + * Make a complete copy of the geometry. + * @returns Clone. + */ + clone(): ol.geom.Point; + + /** + * Return the coordinate of the point. + * @returns Coordinates. + */ + getCoordinates(): ol.Coordinate; + + /** + * Get the type of this geometry. + * @returns Geometry type + */ + getType(): ol.geom.GeometryType; + + /** + * Test if the geometry and the passed extent intersect. + * @param extent Extent + * @returns true if the geometry and the extent intersect. + */ + intersectsExtent(extent: ol.Extent): boolean; + + /** + * Set the coordinate of the point. + * @param coordinates Coordinates. + * @param layout Layout. + */ + setCoordinates(coordinates: ol.Coordinate, layout?: ol.geom.GeometryLayout): void; } - class Polygon { - } + /** + * Polygon geometry. + */ + class Polygon extends SimpleGeometry { - class SimpleGeometry extends Geometry { + /** + * constructor + * @param coordinates Coordinates. + * @param layout Layout. + */ + constructor(coordinates: Array>, layout?: ol.geom.GeometryLayout); + + /** + * Create an approximation of a circle on the surface of a sphere. + * @param sphere The sphere. + * @param center Center (`[lon, lat]` in degrees). + * @param radius The great-circle distance from the center to the polygon vertices. + * @param n Optional number of vertices for the resulting polygon. Default is `32`. + * @returns The "circular" polygon. + */ + static circular(sphere: ol.Sphere, center: ol.Coordinate, radius: number, n?: number): ol.geom.Polygon; + + /** + * Append the passed linear ring to this polygon. + * @param linearRing Linear ring. + */ + appendLinearRing(linearRing: ol.geom.LinearRing): void; + + /** + * Make a complete copy of the geometry. + * @returns Clone. + */ + clone(): ol.geom.Polygon; + + /** + * Return the area of the polygon on projected plane. + * @returns Area (on projected plane). + */ + getArea(): number; + + /** + * Get the coordinate array for this geometry. This array has the structure + * of a GeoJSON coordinate array for polygons. + * + * @param right Orient coordinates according to the right-hand + * rule (counter-clockwise for exterior and clockwise for interior rings). + * If `false`, coordinates will be oriented according to the left-hand rule + * (clockwise for exterior and counter-clockwise for interior rings). + * By default, coordinate orientation will depend on how the geometry was + * constructed. + * @returns Coordinates. + */ + getCoordinates(right?: boolean): Array>; + + /** + * Return an interior point of the polygon. + * @returns Interior point. + */ + getInteriorPoint(): ol.geom.Point; + + /** + * Return the Nth linear ring of the polygon geometry. Return `null` if the + * given index is out of range. + * The exterior linear ring is available at index `0` and the interior rings + * at index `1` and beyond. + * + * @param index Index. + * @returns Linear ring. + */ + getLinearRing(index: number): ol.geom.LinearRing; + + /** + * Return the linear rings of the polygon. + * @returns Linear rings. + */ + getLinearRings(): Array; + + /** + * Get the type of this geometry. + * @returns Geometry type + */ + getType(): ol.geom.GeometryType; + + /** + * Test if the geometry and the passed extent intersect. + * @param extent Extent + * @returns true if the geometry and the extent intersect. + */ + intersectsExtent(extent: ol.Extent): boolean; + + /** + * Set the coordinates of the polygon. + * @param coordinates Coordinates. + * @param layout Layout. + */ + setCoordinates(coordinates: Array>, layout?: ol.geom.GeometryLayout): void; + } + /** + * Abstract base class; only used for creating subclasses; do not instantiate + * in apps, as cannot be rendered. + */ + class SimpleGeometry extends ol.geom.Geometry { + + /** + * Apply a transform function to each coordinate of the geometry. The geometry is modified in place. + * If you do not want the geometry modified in place, first clone() it and then use this function on the clone. + * @param transformFn TransformFunction + */ + applyTransform(transformFn: ol.TransformFunction): void; + + /** + * Return the first coordinate of the geometry. + * @returns First coordinate. + */ + getFirstCoordinate(): ol.Coordinate; + + /** + * Return the last coordinate of the geometry. + * @returns Last point. + */ + getLastCoordinate(): ol.Coordinate; + + /** + * Return the {@link ol.geom.GeometryLayout layout} of the geometry. + * @returns Layout. + */ + getLayout(): ol.geom.GeometryLayout; + + /** + * Translate the geometry. This modifies the geometry coordinates in place. + * If instead you want a new geometry, first clone() this geometry. + * @param deltaX Delta X + * @param deltaY Delta Y + */ + translate(deltaX: number, deltaY: number): void; } } From c491b84f7aa7ebcc1c9b286f1aa085f29c79c1d6 Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Mon, 14 Sep 2015 23:42:39 -0400 Subject: [PATCH 104/329] adds redux-actions --- redux-actions/redux-actions-tests.ts | 54 ++++++++++++++++++++++++++++ redux-actions/redux-actions.d.ts | 34 ++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 redux-actions/redux-actions-tests.ts create mode 100644 redux-actions/redux-actions.d.ts diff --git a/redux-actions/redux-actions-tests.ts b/redux-actions/redux-actions-tests.ts new file mode 100644 index 000000000..68d93ff7b --- /dev/null +++ b/redux-actions/redux-actions-tests.ts @@ -0,0 +1,54 @@ +/// + +const minimalAction: ReduxActions.Action = { type: 'INCREMENT' }; +const richerAction: ReduxActions.Action = { + type: 'INCREMENT', + payload: 2, + error: false, + meta: { + remote: true + } +}; + +const incrementAction: (...args: any[]) => ReduxActions.Action = ReduxActions.createAction( + 'INCREMENT', + (amount: number) => amount +); +const action: ReduxActions.Action = incrementAction(42); + + const incrementByAction: (...args: any[]) => ReduxActions.Action = ReduxActions.createAction( + 'INCREMENT_BY', + (amount: number) => amount, + amount => ({ remote: true }) +); + +const actionHandler = ReduxActions.handleAction( + 'INCREMENT', + (state: number, action: ReduxActions.Action) => state + 1 +); +actionHandler(0, { type: 'INCREMENT' }); + + +const actionHandlerWithReduceMap = ReduxActions.handleAction( + 'INCREMENT_BY', { + next(state: number, action: ReduxActions.Action) { + return state + action.payload; + }, + throw(state: number) { return state } + } +); +actionHandlerWithReduceMap(0, { type: 'INCREMENT' }); + +const actionsHandler = ReduxActions.handleActions({ + 'INCREMENT': (state: number, action: ReduxActions.Action) => state + 1, + 'DECREMENT': (state: number, action: ReduxActions.Action) => state - 1 +}); +actionsHandler(0, { type: 'INCREMENT' }); + +const actionsHandlerWithInitialState = ReduxActions.handleActions({ + 'INCREMENT': (state: number, action: ReduxActions.Action) => state + 1, + 'DECREMENT': (state: number, action: ReduxActions.Action) => state - 1 +}, 0); +actionsHandlerWithInitialState(0, { type: 'INCREMENT' }); + + diff --git a/redux-actions/redux-actions.d.ts b/redux-actions/redux-actions.d.ts new file mode 100644 index 000000000..522f18462 --- /dev/null +++ b/redux-actions/redux-actions.d.ts @@ -0,0 +1,34 @@ +// Type definitions for redux-actions v0.8.0 +// Project: https://github.com/acdlite/redux-actions +// Definitions by: Jack Hsu +// Definitions: https://github.com/borisyankov/DefinitelyTyped +declare module ReduxActions { + // FSA-compliant action. + // See: https://github.com/acdlite/flux-standard-action + type Action = { + type: string + payload?: any + error?: boolean + meta?: any + }; + + type PayloadCreator = (...args: any[]) => T; + type MetaCreator = (...args: any[]) => any; + + type Reducer = (state: T, action: Action) => T; + + type ReducerMap = { + [actionType: string]: Reducer + }; + + export function createAction(actionType: string, payloadCreator?: PayloadCreator, metaCreator?: MetaCreator): (...args: any[]) => Action; + + export function handleAction(actionType: string, reducer: Reducer | ReducerMap): Reducer; + + export function handleActions(reducerMap: ReducerMap, initialState?: T): Reducer; +} + +declare module 'redux-actions' { + export = ReduxActions; +} + From 9e5f06b0f2cafccd67356a0f88c819cefc26c5c8 Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Tue, 15 Sep 2015 01:26:36 -0400 Subject: [PATCH 105/329] adds test for return type of actionHandler/reducer --- redux-actions/redux-actions-tests.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/redux-actions/redux-actions-tests.ts b/redux-actions/redux-actions-tests.ts index 68d93ff7b..53305a2c9 100644 --- a/redux-actions/redux-actions-tests.ts +++ b/redux-actions/redux-actions-tests.ts @@ -22,11 +22,13 @@ const action: ReduxActions.Action = incrementAction(42); amount => ({ remote: true }) ); +let state: number; + const actionHandler = ReduxActions.handleAction( 'INCREMENT', (state: number, action: ReduxActions.Action) => state + 1 ); -actionHandler(0, { type: 'INCREMENT' }); +state = actionHandler(0, { type: 'INCREMENT' }); const actionHandlerWithReduceMap = ReduxActions.handleAction( @@ -37,18 +39,18 @@ const actionHandlerWithReduceMap = ReduxActions.handleAction( throw(state: number) { return state } } ); -actionHandlerWithReduceMap(0, { type: 'INCREMENT' }); +state = actionHandlerWithReduceMap(0, { type: 'INCREMENT' }); const actionsHandler = ReduxActions.handleActions({ 'INCREMENT': (state: number, action: ReduxActions.Action) => state + 1, 'DECREMENT': (state: number, action: ReduxActions.Action) => state - 1 }); -actionsHandler(0, { type: 'INCREMENT' }); +state = actionsHandler(0, { type: 'INCREMENT' }); const actionsHandlerWithInitialState = ReduxActions.handleActions({ 'INCREMENT': (state: number, action: ReduxActions.Action) => state + 1, 'DECREMENT': (state: number, action: ReduxActions.Action) => state - 1 }, 0); -actionsHandlerWithInitialState(0, { type: 'INCREMENT' }); +state = actionsHandlerWithInitialState(0, { type: 'INCREMENT' }); From 00fee00fb40152310d1b205f4f8eed00d81ee983 Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Tue, 15 Sep 2015 01:31:51 -0400 Subject: [PATCH 106/329] adds missing generic type for handleAction test --- redux-actions/redux-actions-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redux-actions/redux-actions-tests.ts b/redux-actions/redux-actions-tests.ts index 53305a2c9..918bfcf17 100644 --- a/redux-actions/redux-actions-tests.ts +++ b/redux-actions/redux-actions-tests.ts @@ -24,14 +24,14 @@ const action: ReduxActions.Action = incrementAction(42); let state: number; -const actionHandler = ReduxActions.handleAction( +const actionHandler = ReduxActions.handleAction( 'INCREMENT', (state: number, action: ReduxActions.Action) => state + 1 ); state = actionHandler(0, { type: 'INCREMENT' }); -const actionHandlerWithReduceMap = ReduxActions.handleAction( +const actionHandlerWithReduceMap = ReduxActions.handleAction( 'INCREMENT_BY', { next(state: number, action: ReduxActions.Action) { return state + action.payload; From f06106d28c1fa5faf0c7395d1ac3f308720729af Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Tue, 15 Sep 2015 02:03:30 -0400 Subject: [PATCH 107/329] fix indentation --- redux-actions/redux-actions-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redux-actions/redux-actions-tests.ts b/redux-actions/redux-actions-tests.ts index 918bfcf17..30dd00a97 100644 --- a/redux-actions/redux-actions-tests.ts +++ b/redux-actions/redux-actions-tests.ts @@ -16,7 +16,7 @@ const incrementAction: (...args: any[]) => ReduxActions.Action = ReduxActions.cr ); const action: ReduxActions.Action = incrementAction(42); - const incrementByAction: (...args: any[]) => ReduxActions.Action = ReduxActions.createAction( +const incrementByAction: (...args: any[]) => ReduxActions.Action = ReduxActions.createAction( 'INCREMENT_BY', (amount: number) => amount, amount => ({ remote: true }) @@ -30,7 +30,6 @@ const actionHandler = ReduxActions.handleAction( ); state = actionHandler(0, { type: 'INCREMENT' }); - const actionHandlerWithReduceMap = ReduxActions.handleAction( 'INCREMENT_BY', { next(state: number, action: ReduxActions.Action) { @@ -54,3 +53,4 @@ const actionsHandlerWithInitialState = ReduxActions.handleActions({ state = actionsHandlerWithInitialState(0, { type: 'INCREMENT' }); + From 19a92cecc19b749d4a5c75cc7680556ee81b955b Mon Sep 17 00:00:00 2001 From: Alexander Rusakov Date: Tue, 15 Sep 2015 11:44:49 +0300 Subject: [PATCH 108/329] predicate returns boolean --- redux-logger/redux-logger.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redux-logger/redux-logger.d.ts b/redux-logger/redux-logger.d.ts index 28b53f3a1..6bc7775f9 100644 --- a/redux-logger/redux-logger.d.ts +++ b/redux-logger/redux-logger.d.ts @@ -13,7 +13,7 @@ declare module 'redux-logger' { logger?: any; timestamp?: boolean; transformer?: (state:any)=>any; - predicate?: (getState:Function, action:any)=>any; + predicate?: (getState:Function, action:any)=>boolean; } export default function createLogger(options?:ReduxLoggerOptions):Redux.Middleware; From c5db2d4088aeae2d695d96d416141dd944533459 Mon Sep 17 00:00:00 2001 From: cstefan Date: Tue, 15 Sep 2015 11:50:36 +0200 Subject: [PATCH 109/329] Update chrome-app.d.ts Added missing removeListener WindowEvent --- chrome/chrome-app.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/chrome/chrome-app.d.ts b/chrome/chrome-app.d.ts index 5cfa0fbce..f75f7dca6 100644 --- a/chrome/chrome-app.d.ts +++ b/chrome/chrome-app.d.ts @@ -138,6 +138,7 @@ declare module chrome.app.window { interface WindowEvent { addListener(callback: () => void): void; + removeListener(callback: () => void): void; } var onBoundsChanged: WindowEvent; From e57adf88d6d06b417320e65f0db7d279effa932e Mon Sep 17 00:00:00 2001 From: Rudolph Gottesheim Date: Tue, 15 Sep 2015 12:32:21 +0200 Subject: [PATCH 110/329] Add definition for Rangy --- rangy/rangy-tests.ts | 95 ++++++++++++++++++++++++++++++++++++++++++++ rangy/rangy.d.ts | 66 ++++++++++++++++++++++++++++++ 2 files changed, 161 insertions(+) create mode 100644 rangy/rangy-tests.ts create mode 100644 rangy/rangy.d.ts diff --git a/rangy/rangy-tests.ts b/rangy/rangy-tests.ts new file mode 100644 index 000000000..b0c6c1cc2 --- /dev/null +++ b/rangy/rangy-tests.ts @@ -0,0 +1,95 @@ +/// + +declare function assertAny(a:any):any; +declare function assertBoolean(b:boolean):any; +declare function assertString(s:string):any; +declare function assertRangyRange(r:RangyRange):any; +declare function getRangyRange():RangyRange; + +function testRangyStatic() { + rangy.addInitListener((rangy:RangyStatic) => { + }); + + rangy.createMissingNativeApi(); + rangy.shim(); + + let nativeRange:Range|TextRange = rangy.createNativeRange(document); + nativeRange = rangy.createNativeRange(window); + nativeRange = rangy.createNativeRange(new HTMLIFrameElement); + nativeRange = rangy.createNativeRange(); + + let rangyRange:RangyRange = rangy.createRange(document); + rangyRange = rangy.createRange(window); + rangyRange = rangy.createRange(new HTMLIFrameElement); + rangyRange = rangy.createRange(); + + rangyRange = rangy.createRangyRange(document); + rangyRange = rangy.createRangyRange(window); + rangyRange = rangy.createRangyRange(new HTMLIFrameElement); + rangyRange = rangy.createRangyRange(); + + let nativeSelection:Selection = rangy.getNativeSelection(window); + nativeSelection = rangy.getNativeSelection(); + + let rangySelection:RangySelection = rangy.getSelection(); + + let initialized:boolean = rangy.initialized; + let supported:boolean = rangy.supported; +} + +function testRangyRange() { + let rangyRange:RangyRange = rangy.createRange(); + + assertBoolean(rangyRange.canSurroundContents()); + rangyRange.collapseAfter(new Node); + rangyRange.collapseBefore(new Node); + rangyRange.collapseToPoint(new Node, 23); + assertAny(rangyRange.compareNode(new Node)); + assertBoolean(rangyRange.containsNode(new Node, true)); + assertBoolean(rangyRange.containsNodeContents(new Node)); + assertBoolean(rangyRange.containsNodeText(new Node)); + assertBoolean(rangyRange.containsNodeText(new Node)); + assertBoolean(rangyRange.containsRange(rangyRange)); + assertBoolean(rangyRange.equals(rangyRange)); + let bookmark:{start:number, end:number} = rangyRange.getBookmark(); + bookmark = rangyRange.getBookmark(new Node); + let doc:Document = rangyRange.getDocument(); + let nodes:Node[] = rangyRange.getNodes(); + nodes = rangyRange.getNodes([new Node]); + nodes = rangyRange.getNodes([new Node], (node:Node) => true); + assertString(rangyRange.inspect()); + assertRangyRange(rangyRange.intersection(rangyRange)); + assertBoolean(rangyRange.intersectsOrTouchesRange(rangyRange)); + assertBoolean(rangyRange.intersectsRange(rangyRange)); + assertBoolean(rangyRange.isValid()); + rangyRange.moveToBookmark({}); + rangyRange.normalizeBoundaries(); + rangyRange.refresh(); + rangyRange.select(); + rangyRange.setStartAndEnd(new Node, 23); + rangyRange.setStartAndEnd(new Node, 23, 42); + rangyRange.setStartAndEnd(new Node, 23, new Node, 42); + rangyRange.splitBoundaries(); + assertString(rangyRange.toHtml()); + assertRangyRange(rangyRange.union(rangyRange)); +} + +function testSelection() { + let selection:RangySelection = rangy.getSelection(); + + selection.detach(); + let ranges:RangyRange[] = selection.getAllRanges(); + selection.getBookmark(new Node); + let nativeTextRange:TextRange = selection.getNativeTextRange(); + assertString(selection.inspect()); + assertBoolean(selection.isBackwards()); + selection.moveToBookmark({}); + var nativeSelection:Selection = selection.nativeSelection; + selection.refresh(); + selection.refresh(true); + selection.restoreRanges({}); + var object:Object = selection.saveRanges(); + selection.setRanges(ranges); + selection.setSingleRange(getRangyRange()); + assertString(selection.toHtml()); +} diff --git a/rangy/rangy.d.ts b/rangy/rangy.d.ts new file mode 100644 index 000000000..16ce2a5a3 --- /dev/null +++ b/rangy/rangy.d.ts @@ -0,0 +1,66 @@ +// Type definitions for Rangy +// Project: https://github.com/timdown/rangy +// Definitions by: Rudolph Gottesheim +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface RangyRange extends Range { + setStartAndEnd(startNode:Node, startOffset:number, endNode?:Node, endOffset?:number):any; + setStartAndEnd(startNode:Node, startOffset:number, endOffset:number):any; + canSurroundContents():boolean; + isValid():boolean; + toHtml():string; + compareNode(node:Node):any; + intersectsOrTouchesRange(range:RangyRange):boolean; + intersectsRange(range:RangyRange):boolean; + intersection(range:RangyRange):RangyRange; + union(range:RangyRange):RangyRange; + containsNode(node:Node, partial:boolean):boolean; + containsNodeContents(node:Node):boolean; + containsNodeText(node:Node):boolean; + containsRange(range:RangyRange):boolean; + splitBoundaries():any; + normalizeBoundaries():any; + collapseToPoint(node:Node, offset:number):any; + collapseBefore(node:Node):any; + collapseAfter(node:Node):any; + getNodes(nodeTypes?:any[], filter?:(node:Node) => boolean):Node[]; + getBookmark(containerNode?:Node):{start:number, end:number}; + moveToBookmark(bookmark:Object):any; + getDocument():Document; + inspect():string; + equals(range:RangyRange):boolean; + refresh():any; + select():any; +} + +interface RangySelection extends Selection { + nativeSelection:Selection; + isBackwards():boolean; + refresh(checkForChanges?:boolean):any; + toHtml():string; + getAllRanges():RangyRange[]; + getNativeTextRange():TextRange; + setSingleRange(range:RangyRange):any; + setRanges(ranges:RangyRange[]):any; + getBookmark(containerNode:Node):any; + moveToBookmark(bookmark:Object):any; + saveRanges():Object; + restoreRanges(saved:Object):any; + detach():any; + inspect():string; +} + +interface RangyStatic { + createNativeRange(doc?:Document|Window|HTMLIFrameElement):TextRange|Range; + createRange(doc?:Document|Window|HTMLIFrameElement):RangyRange; + createRangyRange(doc?:Document|Window|HTMLIFrameElement):RangyRange; + getNativeSelection(win?:Window):Selection; + getSelection():RangySelection; + addInitListener(listener:(rangy:RangyStatic) => void):any; + shim():any; + createMissingNativeApi():any; + initialized:boolean; + supported:boolean; +} + +declare var rangy:RangyStatic; From 21939fb51a4c0046a4c7ef44a10959a5faf14309 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 15 Sep 2015 13:37:24 +0300 Subject: [PATCH 111/329] rename node-config to config --- node-config/node-config-tests.ts => config/config-tests.ts | 2 +- node-config/node-config.d.ts => config/config.d.ts | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename node-config/node-config-tests.ts => config/config-tests.ts (95%) rename node-config/node-config.d.ts => config/config.d.ts (100%) diff --git a/node-config/node-config-tests.ts b/config/config-tests.ts similarity index 95% rename from node-config/node-config-tests.ts rename to config/config-tests.ts index f20ea7f30..2f53b76d6 100644 --- a/node-config/node-config-tests.ts +++ b/config/config-tests.ts @@ -1,4 +1,4 @@ -/// +/// import config = require('config'); diff --git a/node-config/node-config.d.ts b/config/config.d.ts similarity index 100% rename from node-config/node-config.d.ts rename to config/config.d.ts From 59a842d0ba16e44e8f471b3cf1164806d637c879 Mon Sep 17 00:00:00 2001 From: Alexander Rusakov Date: Tue, 15 Sep 2015 15:24:25 +0300 Subject: [PATCH 112/329] whatwg-fetch uses strings and enums --- whatwg-fetch/whatwg-fetch-tests.ts | 8 +++++++- whatwg-fetch/whatwg-fetch.d.ts | 16 ++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/whatwg-fetch/whatwg-fetch-tests.ts b/whatwg-fetch/whatwg-fetch-tests.ts index 5248f5d1d..a7ba5d05c 100644 --- a/whatwg-fetch/whatwg-fetch-tests.ts +++ b/whatwg-fetch/whatwg-fetch-tests.ts @@ -6,7 +6,10 @@ function test_fetchUrlWithOptions() { headers.append("Content-Type", "application/json"); var requestOptions: RequestInit = { method: "POST", - headers: headers + headers: headers, + mode: 'same-origin', + credentials: 'omit', + cache: 'default' }; handlePromise(window.fetch("http://www.andlabs.net/html5/uCOR.php", requestOptions)); } @@ -27,6 +30,9 @@ function test_fetchUrl() { function handlePromise(promise: Promise) { promise.then((response) => { + if (response.type === 'basis') { + // for test only + } return response.text(); }).then((text) => { console.log(text); diff --git a/whatwg-fetch/whatwg-fetch.d.ts b/whatwg-fetch/whatwg-fetch.d.ts index 9efd039b4..f98fb5985 100644 --- a/whatwg-fetch/whatwg-fetch.d.ts +++ b/whatwg-fetch/whatwg-fetch.d.ts @@ -10,20 +10,20 @@ declare class Request { method: string; url: string; headers: Headers; - context: RequestContext; + context: string|RequestContext; referrer: string; - mode: RequestMode; - credentials: RequestCredentials; - cache: RequestCache; + mode: string|RequestMode; + credentials: string|RequestCredentials; + cache: string|RequestCache; } interface RequestInit { method?: string; headers?: HeaderInit|{ [index: string]: string }; body?: BodyInit; - mode?: RequestMode; - credentials?: RequestCredentials; - cache?: RequestCache; + mode?: string|RequestMode; + credentials?: string|RequestCredentials; + cache?: string|RequestCache; } declare enum RequestContext { @@ -58,7 +58,7 @@ declare class Response extends Body { constructor(body?: BodyInit, init?: ResponseInit); error(): Response; redirect(url: string, status: number): Response; - type: ResponseType; + type: string|ResponseType; url: string; status: number; ok: boolean; From e24b3227132ba441741d16a9c03b2efab78704e4 Mon Sep 17 00:00:00 2001 From: "Pascal Senn (GIAPSE)" Date: Tue, 15 Sep 2015 14:57:21 +0200 Subject: [PATCH 113/329] Added Gridstack definition file and test --- gridstack/gridstack-tests.ts | 16 +++ gridstack/gridstack.d.ts | 241 +++++++++++++++++++++++++++++++++++ 2 files changed, 257 insertions(+) create mode 100644 gridstack/gridstack-tests.ts create mode 100644 gridstack/gridstack.d.ts diff --git a/gridstack/gridstack-tests.ts b/gridstack/gridstack-tests.ts new file mode 100644 index 000000000..473d3306e --- /dev/null +++ b/gridstack/gridstack-tests.ts @@ -0,0 +1,16 @@ +// Type definitions for Gridstack +// Project: http://troolee.github.io/gridstack.js/ +// Definitions by: Pascal Senn +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +var options = { + float: true; +}; +var gridstack:GridStack = $(document).gridstack(options); + +gridstack.add_widget("test", 1, 2, 3, 4, true); +gridstack.batch_update(); +gridstack.cell_height();; +gridstack.cell_height(2); +gridstack.cell_width(); +gridstack.get_cell_from_pixel({ left:20, top: 20 }); diff --git a/gridstack/gridstack.d.ts b/gridstack/gridstack.d.ts new file mode 100644 index 000000000..58ee79fbd --- /dev/null +++ b/gridstack/gridstack.d.ts @@ -0,0 +1,241 @@ +// Type definitions for Gridstack +// Project: http://troolee.github.io/gridstack.js/ +// Definitions by: Pascal Senn +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface JQuery { + gridstack (options: IGridstackOptions):GridStack +} + +interface GridStack { + /** + * Creates new widget and returns it. + * + * Widget will be always placed even if result height is more than actual grid height. You need to use will_it_fit method before calling add_widget for additional check. + * + * @param {string} el widget to add + * @param {number} x widget position x + * @param {number} y widget position y + * @param {number} width widget dimension width + * @param {number} height widget dimension height + * @param {boolean} auto_position if true then x, y parameters will be ignored and widget will be places on the first available position + */ + add_widget(el: string, x: number, y: number, width: number, height: number, auto_position: boolean): JQuery + /** + * Initailizes batch updates. You will see no changes until commit method is called. + */ + batch_update() + /** + * Gets current cell height. + */ + cell_height():number + /** + * Update current cell height. This method rebuilds an internal CSS stylesheet. Note: You can expect performance issues if call this method too often. + * @param {number} val the cell height + */ + cell_height(val:number) + /** + * Gets current cell width. + */ + cell_width():number + /** + * Finishes batch updates. Updates DOM nodes. You must call it after batch_update. + */ + commit() + /** + * Destroys a grid instance. + */ + destroy() + /* + * Disables widgets moving/resizing. + */ + disable() + /* + * Enables widgets moving/resizing. + */ + enable() + /* + * Get the position of the cell under a pixel on screen. + * @param {MousePosition} position the position of the pixel to resolve in absolute coordinates, as an object with top and leftproperties + */ + get_cell_from_pixel(position: MousePosition): CellPosition, + /* + * Checks if specified area is empty. + * @param {number} x the position x. + * @param {number} y the position y. + * @param {number} width the width of to check + * @param {number} height the height of to check + */ + is_area_empty(x: number, y: number, width: number, height: number) + /* + * Locks/unlocks widget. + * @param {HTMLElement} el widget to modify. + * @param {boolean} val if true widget will be locked. + */ + locked(el: HTMLElement, val: boolean) + /* + * Set the minWidth for a widget. + * @param {HTMLElement} el widget to modify. + * @param {number} val A numeric value of the number of columns + */ + min_width(el: HTMLElement, val: number) + /* + * Set the minHeight for a widget. + * @param {HTMLElement} el widget to modify. + * @param {number} val A numeric value of the number of rows + */ + min_height(el: HTMLElement, val: number) + /* + * Enables/Disables moving. + * @param {HTMLElement} el widget to modify. + * @param {number} val if true widget will be draggable. + */ + movable(el: HTMLElement, val: boolean) + /** + * Changes widget position + * @param {HTMLElement} el widget to modify + * @param {number} x new position x. If value is null or undefined it will be ignored. + * @param {number} y new position y. If value is null or undefined it will be ignored. + * + */ + move(el: HTMLElement, x: number, y: number) + /** + * Removes widget from the grid. + * @param {HTMLElement} el widget to modify + * @param {boolean} detach_node if false DOM node won't be removed from the tree (Optional. Default true). + */ + remove_widget(el: HTMLElement, detach_node?:boolean) + /** + * Removes all widgets from the grid. + */ + remove_all() + /** + * Changes widget size + * @param {HTMLElement} el widget to modify + * @param {number} width new dimensions width. If value is null or undefined it will be ignored. + * @param {number} height new dimensions height. If value is null or undefined it will be ignored. + */ + resize(el: HTMLElement, width: number, height: number) + /** + * Enables/Disables resizing. + * @param {HTMLElement} el widget to modify + * @param {boolean} val if true widget will be resizable. + */ + resizable(el: HTMLElement, val:boolean) + /** + * Toggle the grid static state. Also toggle the grid-stack-static class. + * @param {boolean} static_value if true the grid become static. + */ + set_static(static_value:boolean) + /** + * Updates widget position/size. + * @param {HTMLElement} el widget to modify + * @param {number} x new position x. If value is null or undefined it will be ignored. + * @param {number} y new position y. If value is null or undefined it will be ignored. + * @param {number} width new dimensions width. If value is null or undefined it will be ignored. + * @param {number} height new dimensions height. If value is null or undefined it will be ignored. + */ + update(el: HTMLElement, x: number, y: number, width: number, height: number) + /** + * Returns true if the height of the grid will be less the vertical constraint. Always returns true if grid doesn't have height constraint. + * @param {number} x new position x. If value is null or undefined it will be ignored. + * @param {number} y new position y. If value is null or undefined it will be ignored. + * @param {number} width new dimensions width. If value is null or undefined it will be ignored. + * @param {number} height new dimensions height. If value is null or undefined it will be ignored. + * @param {boolean} auto_position if true then x, y parameters will be ignored and widget will be places on the first available position + */ + will_it_fit(x: number, y: number, width: number, height: number, auto_position:boolean):boolean + + +} +/** +* Defines the coordiantes of a object +*/ +interface MousePosition { + top: number, + left:number, +} +/** +* Defines the position of a cell inside the grid +*/ +interface CellPosition { + x: number, + y:number +} +declare module GridStackUI { + interface Utils { + /** + * Sorts array of nodes + *@param nodes array to sort + *@param dir 1 for asc, -1 for desc (optional) + *@param width width of the grid. If undefined the width will be calculated automatically (optional). + **/ + sort(nodes:HTMLElement[], dir:number, width:number) + } +} +/** +* Gridstack Options +* Defines the options for a Gridstack +*/ +interface IGridstackOptions { + /** + * if true the resizing handles are shown even if the user is not hovering over the widget (default: false) + */ + always_show_resize_handle: boolean; + /** + * turns animation on (default: true) + */ + animate: boolean; + /** + * if false gridstack will not initialize existing items (default: true) + */ + auto: boolean; + /** + * one cell height (default: 60) + */ + cell_height: number; + /** + * allows to override jQuery UI draggable options. (default: { handle: '.grid-stack-item-content', scroll: true, appendTo: 'body' }) + */ + draggable: {}; + /** + * draggable handle selector (default: '.grid-stack-item-content') + */ + handle: string; + /** + * maximum rows amount.Default is 0 which means no maximum rows + */ + height: number; + /** + * enable floating widgets (default: false) See example + */ + float: boolean; + /** + * widget class (default: 'grid-stack-item') + */ + item_class: string; + /** + * minimal width.If window width is less, grid will be shown in one - column mode (default: 768) + */ + min_width: number; + /** + * class for placeholder (default: 'grid-stack-placeholder') + */ + placeholder_class: string; + /** + * allows to override jQuery UI resizable options. (default: { autoHide: true, handles: 'se' }) + */ + resizable: {}; + /** + * makes grid static (default false).If true widgets are not movable/ resizable.You don't even need jQueryUI draggable/resizable. A CSS class grid-stack-static is also added to the container. + */ + static_grid: boolean; + /** + * vertical gap size (default: 20) + */ + vertical_margin: number; + /** + * amount of columns (default: 12) + */ + width: number; +} From 146b06c68fe791df1a95298d7f79e3cf0205d06b Mon Sep 17 00:00:00 2001 From: Bas Pennings Date: Tue, 15 Sep 2015 15:35:52 +0200 Subject: [PATCH 114/329] New definition files for string.js --- string/string-tests.ts | 286 +++++++++++++++++++++++++++++++++++++++++ string/string.d.ts | 134 +++++++++++++++++++ 2 files changed, 420 insertions(+) create mode 100644 string/string-tests.ts create mode 100644 string/string.d.ts diff --git a/string/string-tests.ts b/string/string-tests.ts new file mode 100644 index 000000000..22fca046d --- /dev/null +++ b/string/string-tests.ts @@ -0,0 +1,286 @@ +/// + +import S = require('string'); + +S('hello').s //"hello" +S(['a,b']).s //"a,b" +S({hi: 'jp'}).s //"[object Object]"" + +S('foo').between('', '').s // => 'foo' +S('foo').between('', '').s // => 'foo' +S('foo').between('', '').s // => 'foo' +S('foo').between('', '').s // => '' +S('Some strings } are very {weird}, dont you think?').between('{', '}').s // => 'weird' +S('This is a test string').between('test').s // => ' string' +S('This is a test string').between('', 'test').s // => 'This is a ' + +S('data_rate').camelize().s; //'dataRate' +S('background-color').camelize().s; //'backgroundColor' +S('-moz-something').camelize().s; //'MozSomething' +S('_car_speed_').camelize().s; //'CarSpeed' +S('yes_we_can').camelize().s; //'yesWeCan' + +S('jon').capitalize().s; //'Jon' +S('JP').capitalize().s; //'Jp' + +S('foobar').chompLeft('foo').s; //'bar' +S('foobar').chompLeft('bar').s; //'foobar' + +S('foobar').chompRight('bar').s; //'foo' +S('foobar').chompRight('foo').s; //'foobar' + +var str = S(' String \t libraries are \n\n\t fun\n! ').collapseWhitespace().s; //'String libraries are fun !' + +S('JavaScript is one of the best languages!').contains('one'); //true + +S('JP likes to program. JP does not play in the NBA.').count("JP")// 2 +S('Does not exist.').count("Flying Spaghetti Monster") //0 +S('Does not exist.').count("Bigfoot") //0 +S('JavaScript is fun, therefore Node.js is fun').count("fun") //2 +S('funfunfun').count("fun") //3 + +S('dataRate').dasherize().s; //'data-rate' +S('CarSpeed').dasherize().s; //'-car-speed' +S('yesWeCan').dasherize().s; //'yes-we-can' +S('backgroundColor').dasherize().s; //'background-color' + +S('Ken Thompson & Dennis Ritchie').decodeHTMLEntities().s; //'Ken Thompson & Dennis Ritchie' +S('3 < 4').decodeHTMLEntities().s; //'3 < 4' + +S("hello jon").endsWith('jon'); //true + +S('
hi
').escapeHTML().s; //<div>hi</div> + +S('subdir').ensureLeft('/').s; //'/subdir' +S('/subdir').ensureLeft('/').s; //'/subdir' + +S('dir').ensureRight('/').s; //'dir/' +S('dir/').ensureRight('/').s; //'dir/' + +S('the_humanize_string_method').humanize().s //'The humanize string method' +S('ThehumanizeStringMethod').humanize().s //'Thehumanize string method' +S('the humanize string method').humanize().s //'The humanize string method' +S('the humanize_id string method_id').humanize().s //'The humanize id string method' +S('the humanize string method ').humanize().s //'The humanize string method' +S(' capitalize dash-CamelCase_underscore trim ').humanize().s //'Capitalize dash camel case underscore trim' + +S('JavaScript is one of the best languages!').include('one'); //true + +S("afaf").isAlpha(); //true +S('fdafaf3').isAlpha(); //false +S('dfdf--dfd').isAlpha(); //false + +S("afaf35353afaf").isAlphaNumeric(); //true +S("FFFF99fff").isAlphaNumeric(); //true +S("99").isAlphaNumeric(); //true +S("afff").isAlphaNumeric(); //true +S("Infinity").isAlphaNumeric(); //true +S("-Infinity").isAlphaNumeric(); //false +S("-33").isAlphaNumeric(); //false +S("aaff..").isAlphaNumeric(); //false + +S(' ').isEmpty(); //true +S('\t\t\t ').isEmpty(); //true +S('\n\n ').isEmpty(); //true +S('helo').isEmpty(); //false +S(null).isEmpty(); //true +S(undefined).isEmpty(); //true + +S('a').isLower(); //true +S('z').isLower(); //true +S('B').isLower(); //false +S('hijp').isLower(); //true +S('hi jp').isLower(); //false +S('HelLO').isLower(); //false + +S("3").isNumeric(); //true +S("34.22").isNumeric(); //false +S("-22.33").isNumeric(); //false +S("NaN").isNumeric(); //false +S("Infinity").isNumeric(); //false +S("-Infinity").isNumeric(); //false +S("JP").isNumeric(); //false +S("-5").isNumeric(); //false +S("000992424242").isNumeric(); //true + +S('a').isUpper() //false +S('z').isUpper() //false +S('B').isUpper() //true +S('HIJP').isUpper() //true +S('HI JP').isUpper() //false +S('HelLO').isUpper() //true +S('crème brûlée').latinise().s // 'creme brulee' + +S('My name is JP').left(2).s; //'My' +S('Hi').left(0).s; //'' +S('My name is JP').left(-2).s; //'JP', same as right(2) + +var stuff = "My name is JP\nJavaScript is my fav language\r\nWhat is your fav language?" +var lines = S(stuff).lines() +console.dir(lines) +/* +[ 'My name is JP', + 'JavaScript is my fav language', + 'What is your fav language?' ] +*/ + +S('hello').pad(5).s //'hello' +S('hello').pad(10).s //' hello ' +S('hey').pad(7).s //' hey ' +S('hey').pad(5).s //' hey ' +S('hey').pad(4).s //' hey' +S('hey').pad(7, '-').s//'--hey--' + +S('hello').padLeft(5).s //'hello' +S('hello').padLeft(10).s //' hello' +S('hello').padLeft(7).s //' hello' +S('hello').padLeft(6).s //' hello' +S('hello').padLeft(10, '.').s //'.....hello' + +S('hello').padRight(5).s //'hello' +S('hello').padRight(10).s //'hello ' +S('hello').padRight(7).s //'hello ' +S('hello').padRight(6).s //'hello ' +S('hello').padRight(10, '.').s //'hello.....' + +S("'a','b','c'").parseCSV(',', "'") //['a', 'b', 'c']) +S('"a","b","c"').parseCSV() // ['a', 'b', 'c']) +S('a,b,c').parseCSV(',', null) //['a', 'b', 'c']) +S("'a,','b','c'").parseCSV(',', "'") //['a,', 'b', 'c']) +S('"a","b",4,"c"').parseCSV(',', null) //['"a"', '"b"', '4', '"c"']) +S('"a","b","4","c"').parseCSV() //['a', 'b', '4', 'c']) +S('"a","b", "4","c"').parseCSV() //['a', 'b', '4', 'c']) +S('"a","b", 4,"c"').parseCSV(",", null) //[ '"a"', '"b"', ' 4', '"c"' ]) +S('"a","b\\"","d","c"').parseCSV() //['a', 'b"', 'd', 'c']) +S('"a","b\\"","d","c"').parseCSV() //['a', 'b"', 'd', 'c']) +S('"a\na","b","c"\n"a", """b\nb", "a"').parseCSV(',', '"', '"', '\n'); // [ [ 'a\na', 'b', 'c' ], [ 'a', '"b\nb', 'a' ] ] + +S(' ').repeat(5).s; //' ' +S('*').repeat(3).s; //'***' + +S(' does IT work? ').replaceAll(' ', '_').s; //'_does_IT_work?_' +S('Yes it does!').replaceAll(' ', '').s; //'Yesitdoes!' + +S(' 1 2 3--__--4 5 6-7__8__9--0').strip(' ', '_', '-').s; //'1234567890' +S('can words also be stripped out?').strip('words', 'also', 'be').s; //'can stripped out?' + +S('I AM CRAZY').right(2).s; //'ZY' +S('Does it work? ').right(4).s; //'k? ' +S('Hi').right(0).s; //'' +S('My name is JP').right(-2).s; //'My', same as left(2) + +S('my name is JP.').capitalize().s; //My name is JP. +var a = "Hello " + S('joe!'); //a = "Hello joe!" +S("Hello").toString() === S("Hello").s; //true + +var myString = S('War'); +myString.setValue('Peace').s; // 'Peace' + +S('Global Thermonuclear Warfare').slugify().s // 'global-thermonuclear-warfare' +S('Crème brûlée').slugify().s // 'creme-brulee' + +S("JP is a software engineer").startsWith("JP"); //true +S('wants to change the world').startsWith("politicians"); //false + +S('My, st[ring] *full* of %punct)').stripPunctuation().s; //My string full of punct + +S('

just some text

').stripTags().s //'just some text' +S('

just some text

').stripTags('p').s //'just some text' + +var str = "Hello {{name}}! How are you doing during the year of {{date-year}}?" +var values = {name: 'JP', 'date-year': 2013} +console.log(S(str).template(values).s) //'Hello JP! How are you doing during the year of 2013?' + +str = "Hello #{name}! How are you doing during the year of #{date-year}?" +console.log(S(str).template(values, '#{', '}').s) //'Hello JP! How are you doing during the year of 2013?' + +S.TMPL_OPEN = '{' +S.TMPL_CLOSE = '}' +str = "Hello {name}! How are you doing during the year of {date-year}?" +console.log(S(str).template(values).s) //'Hello JP! How are you doing during the year of 2013?' + +S(' ').times(5).s //' ' +S('*').times(3).s //'***' + +S('true').toBoolean() //true +S('false').toBoolean() //false +S('hello').toBoolean() //false +S(true).toBoolean() //true +S('on').toBoolean() //true +S('yes').toBoolean() //true +S('TRUE').toBoolean() //true +S('TrUe').toBoolean() //true +S('YES').toBoolean() //true +S('ON').toBoolean() //true +S('').toBoolean() //false +S(undefined).toBoolean() //false +S('undefined').toBoolean() //false +S(null).toBoolean() //false +S(false).toBoolean() //false +S({}).toBoolean() //false +S(1).toBoolean() //true +S(-1).toBoolean() //false +S(0).toBoolean() //false + +S(['a', 'b', 'c']).toCSV().s //'"a","b","c"' +S(['a', 'b', 'c']).toCSV(':').s //'"a":"b":"c"' +S(['a', 'b', 'c']).toCSV(':', null).s //'a:b:c') +S(['a', 'b', 'c']).toCSV('*', "'").s //"'a'*'b'*'c'" +S(['a"', 'b', 4, 'c']).toCSV({delimiter: ',', qualifier: '"', escape: '\\', encloseNumbers: false}).s //'"a\\"","b",4,"c"' +S({firstName: 'JP', lastName: 'Richardson'}).toCSV({keys: true}).s //'"firstName","lastName"' +S({firstName: 'JP', lastName: 'Richardson'}).toCSV().s //'"JP","Richardson"' + +S('5').toFloat() // 5 +S('5.3').toFloat() //5.3 +S(5.3).toFloat() //5.3 +S('-10').toFloat() //-10 +S('55.3 adfafaf').toFloat() // 55.3 +S('afff 44').toFloat() //NaN +S(3.45522222333232).toFloat(2) // 3.46 + +S('5').toInt(); //5 +S('5.3').toInt(); //5; +S(5.3).toInt(); //5; +S('-10').toInt(); //-10 +S('55 adfafaf').toInt(); //55 +S('afff 44').toInt(); //NaN +S('0xff').toInt() //255 + +S('my name is JP.').capitalize().toString(); //My name is JP. +var a = "Hello " + S('joe!'); //a = "Hello joe!" +S("Hello").toString() === S("Hello").s; //true + +S('hello ').trim().s; //'hello' +S(' hello ').trim().s; //'hello' +S('\nhello').trim().s; //'hello' +S('\nhello\r\n').trim().s; //'hello' +S('\thello\t').trim().s; //'hello' + +S(' How are you?').trimLeft().s; //'How are you?'; + +S('How are you? ').trimRight().s; //'How are you?'; + +S('this is some long text').truncate(3).s //'...' +S('this is some long text').truncate(7).s //'this is...' +S('this is some long text').truncate(11).s //'this is...' +S('this is some long text').truncate(12).s //'this is some...' +S('this is some long text').truncate(11).s //'this is...' +S('this is some long text').truncate(14, ' read more').s //'this is some read more' + +S('dataRate').underscore().s; //'data_rate' +S('CarSpeed').underscore().s; //'_car_speed' +S('yesWeCan').underscore().s; //'yes_we_can' + +S('<div>hi</div>').unescapeHTML().s; //
hi
+ +S('Venkat').wrapHTML().s //Venkat +S('Venkat').wrapHTML('div').s //
Venkat
+S('Venkat').wrapHTML('div', { + "class": "left bullet" +}).s //
Venkat
+S('Venkat').wrapHTML('div', { + "id": "content", + "class": "left bullet" +}).s //
Venkat
+ +S.VERSION; //1.0.0 \ No newline at end of file diff --git a/string/string.d.ts b/string/string.d.ts new file mode 100644 index 000000000..d99a78111 --- /dev/null +++ b/string/string.d.ts @@ -0,0 +1,134 @@ +// Type definitions for string.js +// Project: http://stringjs.com +// Definitions by: Bas Pennings +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface StringJS { + length: number; + + s: string; + + between(left: string, right?: string): StringJS; + + camelize(): StringJS; + + capitalize(): StringJS; + + chompLeft(prefix: string): StringJS; + + chompRight(suffix: string): StringJS; + + collapseWhitespace(): StringJS; + + contains(ss: string): boolean; + + count(substring: string): number; + + dasherize(): StringJS; + + decodeHTMLEntities(): StringJS; + + endsWith(ss: string): boolean; + + escapeHTML(): StringJS; + + ensureLeft(prefix: string): StringJS; + + ensureRight(suffix: string): StringJS; + + humanize(): StringJS; + + include(ss: string): boolean; + + isAlpha(): boolean; + + isAlphaNumeric(): boolean; + + isEmpty(): boolean; + + isLower(): boolean; + + isNumeric(): boolean; + + isUpper(): boolean; + + latinise(): StringJS; + + left(n: number): StringJS; + + lines(): string[]; + + pad(len: number, char?: string|number): StringJS; + + padLeft(len: number, char?: string|number): StringJS; + + padRight(len: number, char?: string|number): StringJS; + + parseCSV(delimiter?: string, qualifier?: string, escape?: string, lineDelimiter?: string): string[]; + + repeat(n: number): StringJS; + + replaceAll(ss: string, newStr: string): StringJS; + + strip(...strings: string[]): StringJS; + + right(n: number): StringJS; + + setValue(string: any): StringJS; + + slugify(): StringJS; + + startsWith(prefix: string): boolean; + + stripPunctuation(): StringJS; + + stripTags(...tags: string[]): StringJS; + + template(values: Object, open?: string, close?: string): StringJS; + + times(n: number): StringJS; + + toBoolean(): boolean; + + toCSV(delimiter?: string, qualifier?: string): StringJS; + toCSV(options: { + delimiter?: string, + qualifier?: string, + escape?: string, + encloseNumbers?: boolean, + keys?: boolean + }): StringJS; + + toFloat(precision?: number): number; + + toInt(): number; + + toInteger(): number; + + toString(): string; + + trim(): StringJS; + + trimLeft(): StringJS; + + trimRight(): StringJS; + + truncate(length: number, chars?: string): StringJS; + + underscore(): StringJS; + + unescapeHTML(): StringJS; + + wrapHTML(element?: string, attributes?: Object): StringJS; +} + +declare module "string" { + var S: { + (o: any): StringJS; + VERSION: string; + TMPL_OPEN: string; + TMPL_CLOSE: string; + } + + export = S; +} \ No newline at end of file From 98bb252474b224cda01bd1214169c7f96b65cf28 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sun, 13 Sep 2015 01:09:07 +0500 Subject: [PATCH 115/329] lodash: added _.callback() method (alias iteratee) --- lodash/lodash-tests.ts | 52 ++++++++++++++++++-- lodash/lodash.d.ts | 109 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 158 insertions(+), 3 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 5b9add244..627fa38f8 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1941,9 +1941,32 @@ result = _.words('fred, barney, & pebbles', /[^, ]+/g); result = _('fred, barney, & pebbles').words(); result = _('fred, barney, & pebbles').words(/[^, ]+/g); -/********** -* Utilities * -***********/ +/*********** + * Utility * + ***********/ + +// _.callback +{ + let result: (...args: any[]) => TResult; + result = _.callback(Function); + result = _.callback(Function, any); + result = _(Function).callback().value(); + result = _(Function).callback(any).value(); +} +{ + let result: (object: any) => TResult; + result = _.callback(''); + result = _.callback('', any); + result = _('').callback().value(); + result = _('').callback(any).value(); +} +{ + let result: (object: any) => boolean; + result = _.callback({}); + result = _.callback({}, any); + result = _({}).callback().value(); + result = _({}).callback(any).value(); +} // _.constant result = <() => number>_.constant(1); @@ -1973,6 +1996,29 @@ result = <() => {}>_({}).constant<{}>(); result = _([]).identity(); } +// _.iteratee +{ + let result: (...args: any[]) => TResult; + result = _.iteratee(Function); + result = _.iteratee(Function, any); + result = _(Function).iteratee().value(); + result = _(Function).iteratee(any).value(); +} +{ + let result: (object: any) => TResult; + result = _.iteratee(''); + result = _.iteratee('', any); + result = _('').iteratee().value(); + result = _('').iteratee(any).value(); +} +{ + let result: (object: any) => boolean; + result = _.iteratee({}); + result = _.iteratee({}, any); + result = _({}).iteratee().value(); + result = _({}).iteratee(any).value(); +} + // _.method class TestMethod { a = { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index b6c95710b..bc9898556 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8117,6 +8117,64 @@ declare module _ { attempt(): TResult|Error; } + //_.callback + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of thisArg and arguments of the created function. + * If func is a property name the created callback returns the property value for a given element. If func is + * an object the created callback returns true for elements that contain the equivalent object properties, + * otherwise it returns false. + * + * @param func The value to convert to a callback. + * @param thisArg The this binding of func. + * @result Returns the callback. + */ + callback( + func: Function, + thisArg?: any + ): (...args: any[]) => TResult; + + /** + * @see _.callback + */ + callback( + func: string, + thisArg?: any + ): (object: any) => TResult; + + /** + * @see _.callback + */ + callback( + func: Object, + thisArg?: any + ): (object: any) => boolean; + + /** + * @see _.callback + */ + callback(): (value: TResult) => TResult; + } + + interface LoDashWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashObjectWrapper<(object: any) => TResult>; + } + + interface LoDashObjectWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashObjectWrapper<(...args: any[]) => TResult>; + } + //_.identity interface LoDashStatic { /** @@ -8148,6 +8206,57 @@ declare module _ { identity(): T; } + //_.iteratee + interface LoDashStatic { + /** + * @see _.callback + */ + iteratee( + func: Function, + thisArg?: any + ): (...args: any[]) => TResult; + + /** + * @see _.callback + */ + iteratee( + func: string, + thisArg?: any + ): (object: any) => TResult; + + /** + * @see _.callback + */ + iteratee( + func: Object, + thisArg?: any + ): (object: any) => boolean; + + /** + * @see _.callback + */ + iteratee(): (value: TResult) => TResult; + } + + interface LoDashWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashObjectWrapper<(object: any) => TResult>; + } + + interface LoDashObjectWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashObjectWrapper<(...args: any[]) => TResult>; + } + //_.method interface LoDashStatic { /** From d90348ebccbad06d731f35e3fd7c52779f88f174 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 9 Sep 2015 05:32:01 +0500 Subject: [PATCH 116/329] lodash: added _.prototype.commit() method --- lodash/lodash-tests.ts | 14 ++++++++++++++ lodash/lodash.d.ts | 10 ++++++++++ 2 files changed, 24 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 5b9add244..c5344f7d2 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -439,6 +439,20 @@ result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, result = _([1, 2, 3]).thru((value: number[]) => value, any); } +// _.prototype.commit +{ + let result: _.LoDashWrapper; + result = _(42).commit(); +} +{ + let result: _.LoDashArrayWrapper; + result = _([]).commit(); +} +{ + let result: _.LoDashObjectWrapper; + result = _({}).commit(); +} + /************** * Collection * **************/ diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index b6c95710b..4bc73aae0 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2056,6 +2056,16 @@ declare module _ { thisArg?: any): LoDashArrayWrapper; } + // _.prototype.commit + interface LoDashWrapperBase { + /** + * Executes the chained sequence and returns the wrapped result. + * + * @return Returns the new lodash wrapper instance. + */ + commit(): TWrapper; + } + /************** * Collection * **************/ From bfdee37043dd6c1a755acab4f347cf95a255cf25 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 15 Sep 2015 01:36:11 +0500 Subject: [PATCH 117/329] lodash: changed _.initial() method --- lodash/lodash-tests.ts | 17 +++++--- lodash/lodash.d.ts | 98 +++++++----------------------------------- 2 files changed, 26 insertions(+), 89 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 5b9add244..22ccc3e99 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -282,13 +282,16 @@ result = _.indexOf([1, 2, 3, 1, 2, 3], 2); result = _.indexOf([1, 2, 3, 1, 2, 3], 2, 3); result = _.indexOf([1, 1, 2, 2, 3, 3], 2, true); -result = _.initial([1, 2, 3]); -result = _.initial([1, 2, 3], 2); -result = _.initial([1, 2, 3], function (num) { - return num > 1; -}); -result = _.initial(foodsOrganic, 'organic'); -result = _.initial(foodsType, { 'type': 'vegetable' }); +//_.initial +{ + let testInitalArray: TResult[]; + let testInitalList: _.List; + let result: TResult[]; + result = _.initial(testInitalArray); + result = _.initial(testInitalList); + result = _(testInitalArray).initial().value(); + result = _(testInitalList).initial().value(); +} result = _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index b6c95710b..4e0880850 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -937,92 +937,26 @@ declare module _ { //_.initial interface LoDashStatic { /** - * Gets all but the last element or last n elements of an array. If a callback is provided - * elements at the end of the array are excluded from the result as long as the callback - * returns truey. The callback is bound to thisArg and invoked with three arguments; - * (value, index, array). - * - * If a property name is provided for callback the created "_.pluck" style callback will - * return the property value of the given element. - * - * If an object is provided for callback the created "_.where" style callback will return - * true for elements that have the properties of the given object, else false. - * @param array The array to query. - * @param n Leaves this many elements behind, optional. - * @return Returns everything but the last `n` elements of `array`. - **/ - initial( - array: Array): T[]; + * Gets all but the last element of array. + * + * @param array The array to query. + * @return Returns the slice of array. + */ + initial(array: T[]|List): T[]; + } + interface LoDashArrayWrapper { /** - * @see _.initial - **/ - initial( - array: List): T[]; + * @see _.initial + */ + initial(): LoDashArrayWrapper; + } + interface LoDashObjectWrapper { /** - * @see _.initial - * @param n The number of elements to exclude. - **/ - initial( - array: Array, - n: number): T[]; - - /** - * @see _.initial - * @param n The number of elements to exclude. - **/ - initial( - array: List, - n: number): T[]; - - /** - * @see _.initial - * @param callback The function called per element - **/ - initial( - array: Array, - callback: ListIterator): T[]; - - /** - * @see _.initial - * @param callback The function called per element - **/ - initial( - array: List, - callback: ListIterator): T[]; - - /** - * @see _.initial - * @param pluckValue _.pluck style callback - **/ - initial( - array: Array, - pluckValue: string): T[]; - - /** - * @see _.initial - * @param pluckValue _.pluck style callback - **/ - initial( - array: List, - pluckValue: string): T[]; - - /** - * @see _.initial - * @param whereValue _.where style callback - **/ - initial( - array: Array, - whereValue: W): T[]; - - /** - * @see _.initial - * @param whereValue _.where style callback - **/ - initial( - array: List, - whereValue: W): T[]; + * @see _.initial + */ + initial(): LoDashArrayWrapper; } //_.intersection From f6bf1593866905d9503ebe8a12bb7a3b18eaee53 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Mon, 14 Sep 2015 23:04:49 +0500 Subject: [PATCH 118/329] lodash: changed _.drop() method --- lodash/lodash-tests.ts | 21 +++++++--- lodash/lodash.d.ts | 94 ++++++++++++------------------------------ 2 files changed, 41 insertions(+), 74 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 5b9add244..54b6586c2 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -175,18 +175,27 @@ result = <_.LoDashArrayWrapper>_([0, 1, false, 2, '', 3]).compact(); result = _.difference([1, 2, 3, 4, 5], [5, 2, 10]); result = <_.LoDashArrayWrapper>_([1, 2, 3, 4, 5]).difference([5, 2, 10]); +// _.drop +{ + let testDropArray: TResult[]; + let testDropList: _.List; + let result: TResult[]; + result = _.drop(testDropArray); + result = _.drop(testDropArray, 42); + result = _.drop(testDropList); + result = _.drop(testDropList, 42); + result = _(testDropArray).drop().value(); + result = _(testDropArray).drop(42).value(); + result = _(testDropList).drop().value(); + result = _(testDropList).drop(42).value(); +} + result = _.rest([1, 2, 3]); result = _.rest([1, 2, 3], 2); result = _.rest([1, 2, 3], (num) => num < 3) result = _.rest(foodsOrganic, 'test'); result = _.rest(foodsType, { 'type': 'value' }); -result = _.drop([1, 2, 3]); -result = _.drop([1, 2, 3], 2); -result = _.drop([1, 2, 3], (num) => num < 3) -result = _.drop(foodsOrganic, 'test'); -result = _.drop(foodsType, { 'type': 'value' }); - result = _.tail([1, 2, 3]) result = _.tail([1, 2, 3], 2) result = _.tail([1, 2, 3], (num) => num < 3) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index b6c95710b..39263df8b 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -397,6 +397,32 @@ declare module _ { ...others: List[]): LoDashArrayWrapper; } + //_.drop + interface LoDashStatic { + /** + * Creates a slice of array with n elements dropped from the beginning. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + drop(array: T[]|List, n?: number): T[]; + } + + interface LoDashArrayWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashArrayWrapper; + } + + interface LoDashObjectWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashArrayWrapper; + } + //_.findIndex interface LoDashStatic { /** @@ -1280,74 +1306,6 @@ declare module _ { array: List, whereValue: W): T[]; - /** - * @see _.rest - **/ - drop(array: Array): T[]; - - /** - * @see _.rest - **/ - drop(array: List): T[]; - - /** - * @see _.rest - **/ - drop( - array: Array, - callback: ListIterator, - thisArg?: any): T[]; - - /** - * @see _.rest - **/ - drop( - array: List, - callback: ListIterator, - thisArg?: any): T[]; - - /** - * @see _.rest - **/ - drop( - array: Array, - n: number): T[]; - - /** - * @see _.rest - **/ - drop( - array: List, - n: number): T[]; - - /** - * @see _.rest - **/ - drop( - array: Array, - pluckValue: string): T[]; - - /** - * @see _.rest - **/ - drop( - array: List, - pluckValue: string): T[]; - - /** - * @see _.rest - **/ - drop( - array: Array, - whereValue: W): T[]; - - /** - * @see _.rest - **/ - drop( - array: List, - whereValue: W): T[]; - /** * @see _.rest **/ From 2f9096fa7309f985fee2f1b2faf278281a05281c Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 15 Sep 2015 02:33:09 +0500 Subject: [PATCH 119/329] lodash: changed _.intersection() method --- lodash/lodash-tests.ts | 13 ++++++++++++- lodash/lodash.d.ts | 28 +++++++++++++++++++--------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 5b9add244..049e7c4f1 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -290,7 +290,18 @@ result = _.initial([1, 2, 3], function (num) { result = _.initial(foodsOrganic, 'organic'); result = _.initial(foodsType, { 'type': 'vegetable' }); -result = _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); +// _.intersection +{ + let testIntersectionArray: TResult[]; + let testIntersectionList: _.List; + let result: TResult[]; + result = _.intersection(testIntersectionArray, testIntersectionList); + result = _.intersection(testIntersectionList, testIntersectionArray, testIntersectionList); + result = _(testIntersectionArray).intersection(testIntersectionArray).value(); + result = _(testIntersectionArray).intersection(testIntersectionList, testIntersectionArray).value(); + result = _(testIntersectionList).intersection(testIntersectionArray).value(); + result = _(testIntersectionList).intersection(testIntersectionList, testIntersectionArray).value(); +} result = _.last([1, 2, 3]); result = _([1, 2, 3]).last(); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index b6c95710b..bb8c325ec 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1028,17 +1028,27 @@ declare module _ { //_.intersection interface LoDashStatic { /** - * Creates an array of unique values present in all provided arrays using strict - * equality for comparisons, i.e. ===. - * @param arrays The arrays to inspect. - * @return Returns an array of composite values. - **/ - intersection(...arrays: Array[]): T[]; + * Creates an array of unique values that are included in all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of shared values. + */ + intersection(...arrays: (T[]|List)[]): T[]; + } + interface LoDashArrayWrapper { /** - * @see _.intersection - **/ - intersection(...arrays: List[]): T[]; + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashArrayWrapper; + } + + interface LoDashObjectWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashArrayWrapper; } //_.last From 4168e725434f998bc920787f0979b3c43bb74076 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 9 Sep 2015 04:45:46 +0500 Subject: [PATCH 120/329] lodash: changed _.invert() method --- lodash/lodash-tests.ts | 11 +++++++---- lodash/lodash.d.ts | 20 +++++++++++++++----- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 5b9add244..6ff0f4287 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1552,11 +1552,14 @@ result = _({}).has(42); result = _({}).has(true); result = _({}).has(['', 42, true]); -interface FirstSecond { - first: string; - second: string; +// _.invert +{ + let result: TResult; + result = _.invert({}); + result = _.invert({}, true); + result = _({}).invert().value(); + result = _({}).invert(true).value(); } -result = _.invert({ 'first': 'moe', 'second': 'larry' }); // _.isEqual (alias: _.eq) result = _.isEqual(1, 1); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index b6c95710b..1755d9d06 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -7190,11 +7190,21 @@ declare module _ { //_.invert interface LoDashStatic { /** - * Creates an object composed of the inverted keys and values of the given object. - * @param object The object to invert. - * @return The created inverted object. - **/ - invert(object: any): any; + * Creates an object composed of the inverted keys and values of object. If object contains duplicate values, + * subsequent values overwrite property assignments of previous values unless multiValue is true. + * + * @param object The object to invert. + * @param multiValue Allow multiple values per key. + * @return Returns the new inverted object. + */ + invert(object: T, multiValue?: boolean): TResult; + } + + interface LoDashObjectWrapper { + /** + * @see _.invert + */ + invert(multiValue?: boolean): LoDashObjectWrapper; } //_.isEqual From 0f25d7ef2851c07a8dea50022416a973e40a8f4b Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sun, 13 Sep 2015 01:34:51 +0500 Subject: [PATCH 121/329] lodash: changed _.noConflict() method --- lodash/lodash-tests.ts | 11 +++++++++-- lodash/lodash.d.ts | 14 +++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 5b9add244..9df4ce240 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1716,8 +1716,6 @@ var testAttempFn: TestAttemptFn; result = _.attempt(testAttempFn); result = _(testAttempFn).attempt(); -var lodash = _.noConflict(); - result = _.random(0, 5); result = _.random(5); result = _.random(5, true); @@ -2012,6 +2010,15 @@ result = (_(TestMethodOfObject).methodOf(1, 2).value())(['a', '0 result = _(testMixinSource).mixin(testMixinOptions).value(); } +// _.noConflict +{ + let result: typeof _; + result = _.noConflict(); + result = _(42).noConflict(); + result = _([]).noConflict(); + result = _({}).noConflict(); +} + // _.uniqueId result = _.uniqueId(); result = _.uniqueId(''); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index b6c95710b..a0f1ee47b 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8262,9 +8262,17 @@ declare module _ { //_.noConflict interface LoDashStatic { /** - * Reverts the '_' variable to its previous value and returns a reference to the lodash function. - * @return The lodash function. - **/ + * Reverts the _ variable to its previous value and returns a reference to the lodash function. + * + * @return Returns the lodash function. + */ + noConflict(): typeof _; + } + + interface LoDashWrapperBase { + /** + * @see _.noConflict + */ noConflict(): typeof _; } From bc9e0dfc5ef43c0a8516d137d957e84037daf59e Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 11 Sep 2015 06:14:43 +0500 Subject: [PATCH 122/329] lodash: changed _.result() method --- lodash/lodash-tests.ts | 27 +++++++++++--------------- lodash/lodash.d.ts | 43 +++++++++++++++++++++++++++--------------- 2 files changed, 39 insertions(+), 31 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 5b9add244..55a4efa38 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1664,6 +1664,17 @@ interface TestPickFn { result = _({}).pick(testPickFn, any).value(); } +// _.result +{ + let testResultPath: number|string|boolean|Array; + let testResultDefaultValue: TResult; + let result: TResult; + result = _.result<{}, TResult>({}, testResultPath); + result = _.result<{}, TResult>({}, testResultPath, testResultDefaultValue); + result = _({}).result(testResultPath); + result = _({}).result(testResultPath, testResultDefaultValue); +} + // _.set result = <{ a: { b: { c: number; }}[]}>_.set({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c', 4); result = <{ a: { b: { c: number; }}[]}>_({ 'a': [{ 'b': { 'c': 3 } }] }).set('a[0].b.c', 4).value(); @@ -1735,22 +1746,6 @@ result = _([]).noop(true, 'a', 1); result = _({}).noop(true, 'a', 1); result = _(any).noop(true, 'a', 1); -var object = { - 'cheese': 'crumpets', - 'one': 1, - 'nested': { - 'two': 2 - }, - 'stuff': function () { - return 'nonsense'; - } -}; - -result = _.result(object, 'cheese'); -result = _.result(object, 'stuff'); -result = _.result(object, 'one'); -result = _.result(object, ['nested', 'two'] ); - var tempObject = {}; result = _.runInContext(tempObject); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index b6c95710b..9bccd7cb0 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -7540,6 +7540,34 @@ declare module _ { ): LoDashObjectWrapper; } + //_.result + interface LoDashStatic { + /** + * This method is like _.get except that if the resolved value is a function it’s invoked with the this binding + * of its parent object and its result is returned. + * + * @param object The object to query. + * @param path The path of the property to resolve. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + result( + object: TObject, + path: number|string|boolean|Array, + defaultValue?: TResult + ): TResult; + } + + interface LoDashWrapperBase { + /** + * @see _.result + */ + result( + path: number|string|boolean|Array, + defaultValue?: TResult + ): TResult; + } + //_.set interface LoDashStatic { /** @@ -8379,21 +8407,6 @@ declare module _ { random(min: number, max: number, floating?: boolean): number; } - //_.result - interface LoDashStatic { - /** - * Resolves the value of property on object. If property is a function it will be invoked with - * the this binding of object and its result returned, else the property value is returned. If - * object is false then undefined is returned. - * @param object The object to query. - * @param path The path of the property to resolve. - * @param defaultValue The value returned if the resolved value is undefined. - * @return The resolved value. - **/ - - result(object: any, path: string|string[], defaultValue?: T): T; - } - //_.runInContext interface LoDashStatic { /** From 27727abb064584b59bfd72d630daad15239a73b7 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 12 Sep 2015 23:25:45 +0500 Subject: [PATCH 123/329] lodash: changed _.set() method --- lodash/lodash-tests.ts | 11 +++++++++-- lodash/lodash.d.ts | 25 +++++++++++++++++-------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 5b9add244..345c0d787 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1665,8 +1665,15 @@ interface TestPickFn { } // _.set -result = <{ a: { b: { c: number; }}[]}>_.set({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c', 4); -result = <{ a: { b: { c: number; }}[]}>_({ 'a': [{ 'b': { 'c': 3 } }] }).set('a[0].b.c', 4).value(); +{ + let testSetObject: TResult; + let testSetPath: {toSting(): string}; + let result: TResult; + result = _.set(testSetObject, testSetPath, any); + result = _.set(testSetObject, [testSetPath], any); + result = _(testSetObject).set(testSetPath, any).value(); + result = _(testSetObject).set([testSetPath], any).value(); +} result = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function (r: number[], num: number) { num *= num; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index b6c95710b..de6eeb8e3 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -7543,23 +7543,28 @@ declare module _ { //_.set interface LoDashStatic { /** - * Sets the property value of path on object. If a portion of path does not exist it is created. + * Sets the property value of path on object. If a portion of path does not exist it’s created. + * * @param object The object to augment. * @param path The path of the property to set. * @param value The value to set. * @return Returns object. - **/ - set(object: T, - path: string|string[], - value: any): T; + */ + set( + object: T, + path: StringRepresentable|StringRepresentable[], + value: any + ): T; } interface LoDashObjectWrapper { /** * @see _.set - **/ - set(path: string|string[], - value: any): LoDashObjectWrapper; + */ + set( + path: StringRepresentable|StringRepresentable[], + value: any + ): LoDashObjectWrapper; } //_.transform @@ -8514,6 +8519,10 @@ declare module _ { interface Dictionary { [index: string]: T; } + + interface StringRepresentable { + toString(): string; + } } declare module "lodash" { From 05bbc8bb835462dafab4188c8cc3e69f2f4ba49a Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 9 Sep 2015 07:31:13 +0500 Subject: [PATCH 124/329] riotcontrol: added definitions --- riotcontrol/riotcontrol.d.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 riotcontrol/riotcontrol.d.ts diff --git a/riotcontrol/riotcontrol.d.ts b/riotcontrol/riotcontrol.d.ts new file mode 100644 index 000000000..0fcafcf28 --- /dev/null +++ b/riotcontrol/riotcontrol.d.ts @@ -0,0 +1,26 @@ +// Type definitions for RiotControl +// Project: https://github.com/jimsparkman/RiotControl +// Definitions by: Ilya Mochalov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module RiotControl { + interface Store { + on(events: string, fn: Function): Store; + one(name: string, fn: Function): Store; + off(events: string, fn?: Function): Store; + trigger(name: string, ...args: any[]): Store; + } + + var _stores: Store[]; + + function addStore(store: Store): void; + + function on(events: string, fn: Function): void; + function one(name: string, fn: Function): void; + function off(events: string, fn?: Function): void; + function trigger(name: string, ...args: any[]): void; +} + +declare module "riotcontrol" { + export = RiotControl; +} From 026ee4de9e4c7ef14276e77bb5f511b453302f7b Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 9 Sep 2015 07:31:32 +0500 Subject: [PATCH 125/329] riotcontrol: added tests --- riotcontrol/riotcontrol-tests.ts | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 riotcontrol/riotcontrol-tests.ts diff --git a/riotcontrol/riotcontrol-tests.ts b/riotcontrol/riotcontrol-tests.ts new file mode 100644 index 000000000..b3eee8b2e --- /dev/null +++ b/riotcontrol/riotcontrol-tests.ts @@ -0,0 +1,41 @@ +/// + +import riotcontrol = require('riotcontrol'); + +{ + let store: RiotControl.Store; + let result: void; + result = riotcontrol.addStore(store); +} + +{ + let events: string; + let fn: Function; + let result: void; + result = riotcontrol.on(events, fn); +} + +{ + let name: string; + let fn: Function; + let result: void; + result = riotcontrol.one(name, fn); +} + +{ + let events: string; + let fn: Function; + let result: void; + result = riotcontrol.off(events); + result = riotcontrol.off(events, fn); +} + +{ + let name: string; + let arg: any; + let result: void; + result = riotcontrol.trigger(name); + result = riotcontrol.trigger(name, arg); + result = riotcontrol.trigger(name, arg, arg); + result = riotcontrol.trigger(name, arg, arg, arg); +} From dfbe38f675105e25a750e7576ba13e4ba145e7cd Mon Sep 17 00:00:00 2001 From: Bas Pennings Date: Tue, 15 Sep 2015 22:43:38 +0200 Subject: [PATCH 126/329] New definitions for faker --- faker/faker-tests.ts | 156 ++++++++++++++++++++++++++ faker/faker.d.ts | 260 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 416 insertions(+) create mode 100644 faker/faker-tests.ts create mode 100644 faker/faker.d.ts diff --git a/faker/faker-tests.ts b/faker/faker-tests.ts new file mode 100644 index 000000000..94cb3b30a --- /dev/null +++ b/faker/faker-tests.ts @@ -0,0 +1,156 @@ +/// + +import faker = require('faker'); + +faker.address.zipCode(); +faker.address.zipCode('###'); +faker.address.city(); +faker.address.city(0); +faker.address.cityPrefix(); +faker.address.citySuffix(); +faker.address.streetName(); +faker.address.streetAddress(); +faker.address.streetAddress(false);; +faker.address.streetSuffix(); +faker.address.streetPrefix(); +faker.address.secondaryAddress(); +faker.address.county(); +faker.address.country(); +faker.address.countryCode(); +faker.address.state(); +faker.address.state(false); +faker.address.stateAbbr(); +faker.address.latitude(); +faker.address.longitude(); + +faker.commerce.color(); +faker.commerce.department(); +faker.commerce.productName(); +faker.commerce.price(); +faker.commerce.price(0, 0, 0, '#'); +faker.commerce.productAdjective(); +faker.commerce.productMaterial(); +faker.commerce.product(); + +faker.company.suffixes(); +faker.company.companyName(); +faker.company.companyName(0); +faker.company.companySuffix(); +faker.company.catchPhrase(); +faker.company.bs(); +faker.company.catchPhraseAdjective(); +faker.company.catchPhraseDescriptor(); +faker.company.catchPhraseNoun(); +faker.company.bsAdjective(); +faker.company.bsBuzz(); +faker.company.bsNoun(); + +faker.date.past(); +faker.date.future(); +faker.date.between('foo', 'bar'); +faker.date.between(new Date(), new Date()); +faker.date.recent(); +faker.date.recent(100); +faker.date.month(); +faker.date.month({ + abbr: true, + context: true +}); +faker.date.weekday(); +faker.date.weekday({ + abbr: true, + context: true +}); + +faker.finance.account(); +faker.finance.account(0); +faker.finance.accountName(); +faker.finance.mask(); +faker.finance.mask(0, false, false); +faker.finance.amount(); +faker.finance.amount(0, 0, 0, '#'); +faker.finance.transactionType(); +faker.finance.currencyCode(); +faker.finance.currencyName(); +faker.finance.currencySymbol(); + +faker.hacker.abbreviation(); +faker.hacker.adjective(); +faker.hacker.noun(); +faker.hacker.verb(); +faker.hacker.ingverb(); +faker.hacker.phrase(); + +faker.helpers.randomize(); +faker.helpers.randomize([1,2,3,4]); +faker.helpers.randomize(['foo', 'bar', 'quux']); +faker.helpers.slugify('foo bar quux'); +faker.helpers.replaceSymbolWithNumber('foo# bar#'); +faker.helpers.replaceSymbols('foo# bar? quux#'); +faker.helpers.shuffle(['foo', 'bar', 'quux']); +faker.helpers.mustache('{{foo}}{{bar}}', {foo: 'x', bar: 'y'}); +faker.helpers.createCard(); +faker.helpers.contextualCard(); +faker.helpers.userCard(); + +faker.internet.avatar(); +faker.internet.email(); +faker.internet.email('foo', 'bar', 'quux'); +faker.internet.protocol(); +faker.internet.url(); +faker.internet.domainName(); +faker.internet.domainSuffix(); +faker.internet.domainWord(); +faker.internet.ip(); +faker.internet.userAgent(); +faker.internet.color(); +faker.internet.color(0, 0, 0); +faker.internet.mac(); +faker.internet.password(); +faker.internet.password(0, false, '#', 'foo'); + +faker.lorem.words(); +faker.lorem.words(0); +faker.lorem.sentence(); +faker.lorem.sentence(0, 0); +faker.lorem.sentences(); +faker.lorem.sentences(0); +faker.lorem.paragraph(); +faker.lorem.paragraph(0); +faker.lorem.paragraphs(); +faker.lorem.paragraphs(0, ''); + +faker.name.firstName(); +faker.name.firstName(0); +faker.name.lastName(); +faker.name.lastName(0); +faker.name.findName(); +faker.name.findName('', '', 0); +faker.name.jobTitle(); +faker.name.prefix(); +faker.name.suffix(); +faker.name.title(); +faker.name.jobDescriptor(); +faker.name.jobArea(); +faker.name.jobType(); + +faker.phone.phoneNumber(); +faker.phone.phoneNumber('#'); +faker.phone.phoneNumberFormat(); +// https://github.com/Marak/faker.js/blob/master/lib/phone_number.js#L9-L13 +faker.phone.phoneNumberFormat(0); +faker.phone.phoneFormats(); + +faker.random.number(); +faker.random.number(0); +faker.random.number({ + min: 0, + max: 0, + precision: 0 +}); +faker.random.arrayElement(); +faker.random.arrayElement(['foo', 'bar', 'quux']) +faker.random.objectElement(); +faker.random.objectElement({foo: 'bar', field: 'foo'}); +faker.random.uuid(); +faker.random.boolean(); \ No newline at end of file diff --git a/faker/faker.d.ts b/faker/faker.d.ts new file mode 100644 index 000000000..b337c093e --- /dev/null +++ b/faker/faker.d.ts @@ -0,0 +1,260 @@ +// Type definitions for faker +// Project: http://marak.com/faker.js/ +// Definitions by: Bas Pennings +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module Faker { + interface Post { + words: string; + sentence: string; + sentences: string; + paragraph: string; + } + + interface Address { + street: string; + suite: string; + city: string; + zipcode: string; + geo: { + lat: string; + lon: string + } + } + + interface Transaction { + amount: number, + date: Date, + business: string, + name: string, + type: string, + account: string + } + + interface Company { + name: string; + catchPhrase: string; + bs: string; + } + + interface Card { + name: string; + username: string; + email: string; + address: Address; + phone: string, + website: string, + company: Company; + posts: Post[], + accountHistory: Transaction[] + } + + interface ContextualCard { + name: string; + username: string; + avatar: string; + email: string; + dob: Date; + phone: string; + address: Address; + website: string; + company: Company; + } + + interface UserCard { + name: string; + username: string; + email: string; + address: Address; + phone: string; + website: string; + company: Company; + } + + interface AddressGenerators { + zipCode(format?: string): string; + city(format?: number): string; + cityPrefix(): string; + citySuffix(): string; + streetName(): string; + streetAddress(useFullAddress?: boolean): string; + streetSuffix(): string; + streetPrefix(): string; + secondaryAddress(): string; + county(): string; + country(): string; + countryCode(): string; + state(useAbbr?: boolean): string; + stateAbbr(): string; + latitude(): string; + longitude(): string; + } + + interface CommerceGenerators { + color(): string; + department(): string; + productName(): string; + price(min?: number, max?: number, dec?: number, symbol?: string): string; + productAdjective(): string; + productMaterial(): string; + product(): string; + } + + interface CompanyGenerators { + suffixes(): string[]; + companyName(format?: number): string; + companySuffix(): string; + catchPhrase(): string; + bs(): string; + catchPhraseAdjective(): string; + catchPhraseDescriptor(): string; + catchPhraseNoun(): string; + bsAdjective(): string; + bsBuzz(): string; + bsNoun(): string; + } + + interface DateGenerators { + past(years?: number, refDate?: Date|string): Date; + future(years?: number, refDate?: Date|string): Date; + between(from: Date|string, to: Date|string): Date; + recent(days?: number): Date; + month(options?: { + abbr?: boolean, + context?: boolean + }): string; + weekday(options?: { + abbr?: boolean, + context?: boolean + }): string; + } + + interface FinanceGenerators { + account(length?: number): string; + accountName(): string; + mask(length?: number, parens?: boolean, elipsis?: boolean): string; + amount(min?: number, max?: number, dec?: number, symbol?: string): string; + transactionType(): string; + currencyCode(): string; + currencyName(): string; + currencySymbol(): string; + } + + interface HackerGenerators { + abbreviation(): string; + adjective(): string; + noun(): string; + verb(): string; + ingverb(): string; + phrase(): string; + } + + interface Helpers { + randomize(array?: Array): T; + slugify(str: string): string; + replaceSymbolWithNumber(s: string, symbol?: string): string; + replaceSymbols(str: string): string; + shuffle(array: Array): Array; + mustache(str: string, data: Object): string; + createCard(): Card; + contextualCard(): Card; + userCard(): UserCard; + createTransaction(): Transaction; + } + + interface ImageGenerators { + image(): string; + avator(): string; + imageUrl(width?: number, height?: number, category?: string): string; + abstract(width?: number, height?: number): string; + animals(width?: number, height?: number): string; + business(width?: number, height?: number): string; + cats(width?: number, height?: number): string; + city(width?: number, height?: number): string; + food(width?: number, height?: number): string; + nightlife(width?: number, height?: number): string; + fashion(width?: number, height?: number): string; + people(width?: number, height?: number): string; + nature(width?: number, height?: number): string; + sports(width?: number, height?: number): string; + technics(width?: number, height?: number): string; + transport(width?: number, height?: number): string; + } + + interface InternetGenerators { + avatar(): string; + email(firstName?: string, lastName?: string, provider?: string): string; + userName(firstName?: string, lastName?: string): string; + protocol(): string; + url(): string; + domainName(): string; + domainSuffix(): string; + domainWord(): string; + ip(): string; + userAgent(): string; + color(baseRed255?: number, baseGreen255?: number, baseBlue255?: number): string; + mac(): string; + password(len?: number, memorable?: boolean, pattern?: string, prefix?: string): string; + } + + interface LoremGenerators { + words(num?: number): string[]; + sentence(wordCount?: number, range?: number): string; + sentences(sentenceCount?: number): string; + paragraph(sentenceCount?: number): string; + paragraphs(paragraphCount?: number, separator?: string): string; + } + + interface NameGenerators { + firstName(gender?: number): string; + lastName(gender?: number): string; + findName(firstName?: string, lastName?: string, gender?: number): string; + jobTitle(): string; + prefix(): string; + suffix(): string; + title(): string; + jobDescriptor(): string; + jobArea(): string; + jobType(): string; + } + + interface PhoneGenerators { + phoneNumber(format?: string): string; + // https://github.com/Marak/faker.js/blob/master/lib/phone_number.js#L9-L13 + phoneNumberFormat(phoneFormatsArrayIndex?: number): string; + phoneFormats(): string; + } + + interface RandomGenerators { + number(max: number): number; + number(options?: { + min?: number, + max?: number, + precision?: number + }): number; + arrayElement(array?: Array): T; + objectElement(object?: Object, field?: string): any; + uuid(): string; + boolean(): boolean; + } +} + +declare module "faker" { + var faker: { + address: Faker.AddressGenerators; + commerce: Faker.CommerceGenerators; + company: Faker.CompanyGenerators; + date: Faker.DateGenerators; + finance: Faker.FinanceGenerators; + hacker: Faker.HackerGenerators; + helpers: Faker.Helpers; + image: Faker.ImageGenerators; + internet: Faker.InternetGenerators; + lorem: Faker.LoremGenerators; + name: Faker.NameGenerators; + phone: Faker.PhoneGenerators; + random: Faker.RandomGenerators; + } + + export = faker; +} From dacf9af77663385080fee3811ddb60917e06ca5b Mon Sep 17 00:00:00 2001 From: mathieudugal Date: Tue, 15 Sep 2015 17:14:45 -0400 Subject: [PATCH 127/329] Test the ol.geom module Tests related to the typing definitions of the ol.geom module --- openlayers/openlayers-tests.ts | 174 ++++++++++++++++++++++++++++++++- 1 file changed, 173 insertions(+), 1 deletion(-) diff --git a/openlayers/openlayers-tests.ts b/openlayers/openlayers-tests.ts index 009273746..1e59ebb44 100644 --- a/openlayers/openlayers-tests.ts +++ b/openlayers/openlayers-tests.ts @@ -16,8 +16,11 @@ var featureLoader: ol.FeatureLoader; var easingFunction: (t: number) => number; // Type variables for OpenLayers +var circle: ol.geom.Circle; var color: ol.Color; var coordinate: ol.Coordinate; +var coordinatesArray: Array; +var coordinatesArrayDim2: Array>; var extent: ol.Extent; var boundingCoordinates: Array; var size: ol.Size; @@ -27,14 +30,28 @@ var feature: ol.Feature; var featureArray: Array; var graticule: ol.Graticule var geometry: ol.geom.Geometry; +var geometriesArray: Array; var feature: ol.Feature; var featureArray: Array; var featureFormat: ol.format.Feature; var geometry: ol.geom.Geometry; +var geometryCollection: ol.geom.GeometryCollection; +var geometryLayout: ol.geom.GeometryLayout; +var geometryType: ol.geom.GeometryType; +var linearRing: ol.geom.LinearRing; +var lineString: ol.geom.LineString; var loadingstrategy: ol.LoadingStrategy; +var multiLineString: ol.geom.MultiLineString; +var multiPoint: ol.geom.MultiPoint; +var multiPolygon: ol.geome.MultiPolygon; +var point: ol.geom.Point; +var polygon: ol.geom.Polygon; +var simpleGeometry: ol.geom.SimpleGeometry; var tilegrid: ol.tilegrid.TileGrid; var vector: ol.source.Vector; var projection: ol.proj.Projection; +var projectionLike: ol.proj.ProjectionLike; +var transformFn: ol.TransformFunction; // // ol.Attribution @@ -103,17 +120,172 @@ loadingstrategy = ol.loadingstrategy.all; loadingstrategy = ol.loadingstrategy.bbox; loadingstrategy = ol.loadingstrategy.tile(tilegrid); +// +// +// ol.geom.Circle +// +booleanValue = circle.intersectsExtent(extent); +circle = circle.transform(projectionLike, projectionLike); + // // // ol.geom.Geometry // - var geometryResult: ol.geom.Geometry; coordinate = geometryResult.getClosestPoint(coordinate); geometryResult.getClosestPoint(coordinate, coordinate); extent = geometryResult.getExtent(); geometryResult.getExtent(extent); +// +// +// ol.geom.GeometryCollection +// +geometryCollection = new ol.geom.GeometryCollection(geometriesArray) +geometryCollection = new ol.geom.GeometryCollection(); +voidValue = geometryCollection.applyTransform(transformFn); +geometryCollection = geometryCollection.clone(); +geometriesArray = geometryCollection.getGeometries(); +geometryType = geometryCollection.getType(); +booleanValue = geometryCollection.intersectsExtent(extent); +voidValue = geometryCollection.setGeometries(geometriesArray); + +// +// +// ol.geom.LinearRing +// +linearRing = new ol.geom.LinearRing(coordinatesArray); +linearRing = new ol.geom.LinearRing(coordinatesArray, geometryLayout); +linearRing = linearRing.clone(); +numberValue = linearRing.getArea(); +coordinatesArray = linearRing.getCoordinates(); +geometryType = linearRing.getType(); +voidValue = linearRing.setCoordinates(coordinatesArray); +voidValue = linearRing.setCoordinates(coordinatesArray, geometryLayout); + +// +// +// ol.geom.LineString +// +lineString = new ol.geom.LineString(coordinatesArray); +lineString = new ol.geom.LineString(coordinatesArray, geometryLayout); +voidValue = lineString.appendCoordinate(coordinate); +lineString = lineString.clone(); +coordinate = lineString.getCoordinateAtM(numberValue); +coordinate = lineString.getCoordinateAtM(numberValue, booleanValue); +coordinatesArray = lineString.getCoordinates(); +numberValue = lineString.getLength(); +geometryType = lineString.getType(); +booleanValue = lineString.intersectsExtent(extent); +voidValue = lineString.setCoordinates(coordinatesArray); +voidValue = lineString.setCoordinates(coordinatesArray, geometryLayout); + +// +// +// ol.geom.MultiLineString +// +var lineStringsArray: Array; + +multiLineString = new ol.geom.MultiLineString(coordinatesArrayDim2); +multiLineString = new ol.geom.MultiLineString(coordinatesArrayDim2, geometryLayout); +voidValue = multiLineString.appendLineString(lineString); +multiLineString = multiLineString.clone(); +coordinate = multiLineString.getCoordinateAtM(numberValue); +coordinate = multiLineString.getCoordinateAtM(numberValue, booleanValue); +coordinate = multiLineString.getCoordinateAtM(numberValue, booleanValue, booleanValue); +coordinatesArrayDim2 = multiLineString.getCoordinates(); +lineString = multiLineString.getLineString(numberValue); +lineStringsArray = multiLineString.getLineStrings(); +geometryType = multiLineString.getType(); +booleanValue = multiLineString.intersectsExtent(extent); +voidValue = multiLineString.setCoordinates(coordinatesArrayDim2); +voidValue = multiLineString.setCoordinates(coordinatesArrayDim2, geometryLayout); + +// +// +// ol.geom.MultiPoint +// +var pointsArray: Array; + +multiPoint = new ol.geom.MultiPoint(coordinatesArray); +multiPoint = new ol.geom.MultiPoint(coordinatesArray, geometryLayout); +voidValue = multiPoint.appendPoint(point); +multiPoint = multiPoint.clone(); +coordinatesArray = multiPoint.getCoordinates(); +point = multiPoint.getPoint(numberValue); +pointsArray = multiPoint.getPoints(); +geometryType = multiPoint.getGeometryType(); +booleanValue = multiPoint.intersectsExtent(extent); +voidValue = multiPoint.setCoordinates(coordinatesArray); +voidValue = multiPoint.setCoordinates(coordinatesArray, geometryLayout); + +// +// +// ol.geom.MultiPolygon +// +var coordinatesArrayDim3: Array>>; +var polygonsArray: Array; + +multiPolygon = new ol.geom.MultiPolygon(coordinatesArrayDim3); +multiPolygon = new ol.geom.MultiPolygon(coordinatesArrayDim3, geometryLayout); +voidValue = multiPolygon.appendPolygon(polygon); +multiPolygon = multiPolygon.clone(); +numberValue = multiPolygon.getArea(); +coordinatesArrayDim3 = multiPolygon.getCoordinates(); +coordinatesArrayDim3 = multiPolygon.getCoordinates(booleanValue); +multiPoint = multiPolygon.getInteriorPoints(); +polygon = multiPolygon.getPolygon(numberValue); +polygonsArray = multiPolygon.getPolygons(); +geometryType = multiPolygon.getType(); +booleanValue = multiPolygon.intersectsExtent(extent); +voidValue = multiPolygon.setCoordinates(coordinatesArrayDim3); +voidValue = multiPolygon.setCoordinates(coordinatesArrayDim3, geometryLayout); + +// +// +// ol.geom.Point +// +point = new ol.geom.Point(coordinate); +point = new ol.geom.Point(coordinate, geometryLayout); +point = point.clone(); +coordinate = point.getCoordinates(); +geometryType = point.getType(); +booleanValue = point.intersectsExtent(extent); +voidValue = point.setCoordinates(coordinate); +voidValue = point.setCoordinates(coordinate, geometryLayout); + +// +// +// ol.geom.Polygon +// +var localSphere: ol.sphere; +var linearRingsArray: Array; + +polygon = new ol.geom.Polygon(coordinatesArrayDim2); +polygon = new ol.geom.Polygon(coordinatesArrayDim2, geometryLayout); +polygon = ol.geom.Polygon.circular(localSphere, coordinate, numberValue); +polygon = ol.geom.Polygon.circular(localSphere, coordinate, numberValue, numberValue); +voidValue = polygon.appendLinearRing(linearRing); +polygon = polygon.clone(); +numberValue = polygon.getArea(); +coordinatesArrayDim2 = polygon.getCoordinates(); +coordinatesArrayDim2 = polygon.getCoordinates(booleanValue); +point = polygon.getInteriorPoint(); +linearRing = polygon.getLinearRing(numberValue); +linearRingsArray = polygon.getLinearRings(); +geometryType = polygon.getType(); +booleanValue = polygon.intersectsExtent(extent); + +// +// +// ol.geom.SimpleGeometry +// +simpleGeometry.applyTransform(transformFn); +coordinate = simpleGeometry.getFirstCoordinate(); +coordinate = simpleGeometry.getLastCoordinate(); +geometryLayout = simpleGeometry.getGeometryLayout(); +voidValue = simpleGeometry.translate(numberValue, numberValue); + // // ol.source // From 5bca47d46a833a2ccd7910a3697c04a119011422 Mon Sep 17 00:00:00 2001 From: mathieudugal Date: Tue, 15 Sep 2015 17:21:24 -0400 Subject: [PATCH 128/329] Fix errors --- openlayers/openlayers-tests.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openlayers/openlayers-tests.ts b/openlayers/openlayers-tests.ts index 1e59ebb44..f60e45bd9 100644 --- a/openlayers/openlayers-tests.ts +++ b/openlayers/openlayers-tests.ts @@ -43,7 +43,7 @@ var lineString: ol.geom.LineString; var loadingstrategy: ol.LoadingStrategy; var multiLineString: ol.geom.MultiLineString; var multiPoint: ol.geom.MultiPoint; -var multiPolygon: ol.geome.MultiPolygon; +var multiPolygon: ol.geom.MultiPolygon; var point: ol.geom.Point; var polygon: ol.geom.Polygon; var simpleGeometry: ol.geom.SimpleGeometry; @@ -214,7 +214,7 @@ multiPoint = multiPoint.clone(); coordinatesArray = multiPoint.getCoordinates(); point = multiPoint.getPoint(numberValue); pointsArray = multiPoint.getPoints(); -geometryType = multiPoint.getGeometryType(); +geometryType = multiPoint.getType(); booleanValue = multiPoint.intersectsExtent(extent); voidValue = multiPoint.setCoordinates(coordinatesArray); voidValue = multiPoint.setCoordinates(coordinatesArray, geometryLayout); @@ -258,7 +258,7 @@ voidValue = point.setCoordinates(coordinate, geometryLayout); // // ol.geom.Polygon // -var localSphere: ol.sphere; +var localSphere: ol.Sphere; var linearRingsArray: Array; polygon = new ol.geom.Polygon(coordinatesArrayDim2); @@ -283,7 +283,7 @@ booleanValue = polygon.intersectsExtent(extent); simpleGeometry.applyTransform(transformFn); coordinate = simpleGeometry.getFirstCoordinate(); coordinate = simpleGeometry.getLastCoordinate(); -geometryLayout = simpleGeometry.getGeometryLayout(); +geometryLayout = simpleGeometry.getLayout(); voidValue = simpleGeometry.translate(numberValue, numberValue); // From 930256560156f9c8a9694ee0f4087aee8d9122dd Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 16 Sep 2015 03:11:24 +0500 Subject: [PATCH 129/329] lodash: changed _.slice() method --- lodash/lodash-tests.ts | 14 ++++++++++++-- lodash/lodash.d.ts | 28 +++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 5b9add244..56734e3a4 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -135,8 +135,6 @@ result = _([1, 2, 3, 4]).pop(); result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).push(5, 6, 7); result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).reverse(); result = _([1, 2, 3, 4]).shift(); -result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).slice(1, 2); -result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).slice(2); result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).sort((a, b) => 1); result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).splice(1); result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).splice(1, 2, 5, 6); @@ -315,6 +313,18 @@ result = _.remove(foodsOrganic, 'organic'); result = _.remove(foodsType, { 'type': 'vegetable' }); var typedResult: IFoodType[] = _.remove([ { name: 'apple' }, { name: 'orange' }], { name: 'orange' }); +// _.slice +{ + let testSliceArray: TResult[]; + let result: TResult[]; + result = _.slice(testSliceArray); + result = _.slice(testSliceArray, 42); + result = _.slice(testSliceArray, 42, 42); + result = _(testSliceArray).slice().value(); + result = _(testSliceArray).slice(42).value(); + result = _(testSliceArray).slice(42, 42).value(); +} + result = _.sortedIndex([20, 30, 50], 40); result = _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); var sortedIndexDict: { wordToNumber: { [idx: string]: number } } = { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index b6c95710b..bdc6d129e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -258,7 +258,6 @@ declare module _ { push(...items: T[]): LoDashArrayWrapper; reverse(): LoDashArrayWrapper; shift(): T; - slice(start: number, end?: number): LoDashArrayWrapper; sort(compareFn?: (a: T, b: T) => number): LoDashArrayWrapper; splice(start: number): LoDashArrayWrapper; splice(start: number, deleteCount: number, ...items: any[]): LoDashArrayWrapper; @@ -1417,6 +1416,33 @@ declare module _ { whereValue: W): T[]; } + //_.slice + interface LoDashStatic { + /** + * Creates a slice of array from start up to, but not including, end. + * + * @param array The array to slice. + * @param start The start position. + * @param end The end position. + * @return Returns the slice of array. + */ + slice( + array: T[], + start?: number, + end?: number + ): T[]; + } + + interface LoDashArrayWrapper { + /** + * @see _.slice + */ + slice( + start?: number, + end?: number + ): LoDashArrayWrapper; + } + //_.sortedIndex interface LoDashStatic { /** From d92927cf93831fc3b0ea7fa2cedaa3d2361ad696 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 16 Sep 2015 02:28:13 +0500 Subject: [PATCH 130/329] lodash: added _.unzipWith() method --- lodash/lodash-tests.ts | 18 ++++++++++++++++++ lodash/lodash.d.ts | 43 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 5b9add244..167620da5 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -363,6 +363,24 @@ result = _(['A', 'b', 'C', 'a', 'B', 'c']).unique(function (letter) { result = _([1, 2.5, 3, 1.5, 2, 3.5]).unique(function (num) { return this.floor(num); }, Math).value(); result = <{ x: number; }[]>_([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }]).unique('x').value(); +// _.unzipWith +{ + let testUnzipWithArray: (number[]|_.List)[]; + let testUnzipWithList: _.List>; + let testUnzipWithIterator: {(prev: TResult, curr: number, index?: number, list?: number[]): TResult}; + let result: TResult[]; + result = _.unzipWith(testUnzipWithArray); + result = _.unzipWith(testUnzipWithArray, testUnzipWithIterator); + result = _.unzipWith(testUnzipWithArray, testUnzipWithIterator, any); + result = _.unzipWith(testUnzipWithList); + result = _.unzipWith(testUnzipWithList, testUnzipWithIterator); + result = _.unzipWith(testUnzipWithList, testUnzipWithIterator, any); + result = _(testUnzipWithArray).unzipWith(testUnzipWithIterator).value(); + result = _(testUnzipWithArray).unzipWith(testUnzipWithIterator, any).value(); + result = _(testUnzipWithList).unzipWith(testUnzipWithIterator).value(); + result = _(testUnzipWithList).unzipWith(testUnzipWithIterator, any).value(); +} + result = _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); // _.xor diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index b6c95710b..077576a84 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1852,6 +1852,45 @@ declare module _ { whereValue: W): LoDashArrayWrapper; } + //_.unzipWith + interface LoDashStatic { + /** + * This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * + * @param array The array of grouped elements to process. + * @param iteratee The function to combine regrouped values. + * @param thisArg The this binding of iteratee. + * @return Returns the new array of regrouped elements. + */ + unzipWith( + array: List>, + iteratee?: MemoIterator, + thisArg?: any + ): TResult[]; + } + + interface LoDashArrayWrapper { + /** + * @see _.unzipWith + */ + unzipWith( + iteratee?: MemoIterator, + thisArg?: any + ): LoDashArrayWrapper; + } + + interface LoDashObjectWrapper { + /** + * @see _.unzipWith + */ + unzipWith( + iteratee?: MemoIterator, + thisArg?: any + ): LoDashArrayWrapper; + } + //_.without interface LoDashStatic { /** @@ -8489,10 +8528,10 @@ declare module _ { } interface MemoVoidIterator { - (prev: TResult, curr: T, indexOrKey: any, list?: T[]): void; + (prev: TResult, curr: T, indexOrKey?: any, list?: T[]): void; } interface MemoIterator { - (prev: TResult, curr: T, indexOrKey: any, list?: T[]): TResult; + (prev: TResult, curr: T, indexOrKey?: any, list?: T[]): TResult; } /* interface MemoListIterator { From fda3f446c8d12557aae3223830bae8bf07721e8f Mon Sep 17 00:00:00 2001 From: Andrew Fong Date: Wed, 16 Sep 2015 00:00:24 +0000 Subject: [PATCH 131/329] chrome.runtime.openOptionsPage --- chrome/chrome-tests.ts | 9 +++++++++ chrome/chrome.d.ts | 1 + 2 files changed, 10 insertions(+) diff --git a/chrome/chrome-tests.ts b/chrome/chrome-tests.ts index cbbe93791..f17c9abc8 100644 --- a/chrome/chrome-tests.ts +++ b/chrome/chrome-tests.ts @@ -249,3 +249,12 @@ function contentSettings() { } }); } + +// https://developer.chrome.com/extensions/runtime#method-openOptionsPage +function testOptionsPage() { + chrome.runtime.openOptionsPage(); + chrome.runtime.openOptionsPage(function() { + // Do a thing ... + }); +} + diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index 2fc2fb6fc..34bb95205 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -1649,6 +1649,7 @@ declare module chrome.runtime { export function getPackageDirectoryEntry(callback: (directoryEntry: any) => void): void; export function getPlatformInfo(callback: (platformInfo: PlatformInfo) => void): void; export function getURL(path: string): string; + export function openOptionsPage(callback?: () => void): void; export function reload(): void; export function requestUpdateCheck(callback: (status: string, details?: UpdateCheckDetails) => void): void; export function restart(): void; From 2aace82653a4a5658385ec844fb672a933c0294f Mon Sep 17 00:00:00 2001 From: psnider Date: Wed, 16 Sep 2015 00:42:38 +0000 Subject: [PATCH 132/329] Added Error to support stack --- node/node.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/node/node.d.ts b/node/node.d.ts index b7edca1f7..fa29b88f4 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -9,6 +9,11 @@ * * ************************************************/ +interface Error { + stack?: string; +} + + // compat for TypeScript 1.5.3 // if you use with --target es3 or --target es5 and use below definitions, // use the lib.es6.d.ts that is bundled with TypeScript 1.5.3. From 0fc180b15bfc3d02eaff2eb367dff3d5e977f2ad Mon Sep 17 00:00:00 2001 From: Jesse Schalken Date: Wed, 16 Sep 2015 11:23:39 +1000 Subject: [PATCH 133/329] Fix typo --- requirejs/require.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirejs/require.d.ts b/requirejs/require.d.ts index 58fb4f6f1..5ca4b476a 100644 --- a/requirejs/require.d.ts +++ b/requirejs/require.d.ts @@ -166,8 +166,8 @@ interface RequireConfig { /** * Extra query string arguments appended to URLs that RequireJS - * uses to fetch resources. Most useful to cachce bust when - * the browser or server is not configured correcty. + * uses to fetch resources. Most useful to cache bust when + * the browser or server is not configured correctly. * * @example * urlArgs: "bust= + (new Date()).getTime() From 1c048a3cf65c5a57e0b0f66a48cd1040fea6e2f2 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 16 Sep 2015 19:52:53 +0500 Subject: [PATCH 134/329] lodash: added _.prototype.plant() method --- lodash/lodash-tests.ts | 26 ++++++++++++++++++++++++++ lodash/lodash.d.ts | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index fc36241c5..af1dbe3e8 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -453,6 +453,32 @@ result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, result = _({}).commit(); } +// _.prototype.plant +{ + let result: _.LoDashWrapper; + result = _(any).plant(42); +} +{ + let result: _.LoDashStringWrapper; + result = _(any).plant(''); +} +{ + let result: _.LoDashWrapper; + result = _(any).plant(true); +} +{ + let result: _.LoDashNumberArrayWrapper; + result = _(any).plant([42]); +} +{ + let result: _.LoDashArrayWrapper; + result = _(any).plant([]); +} +{ + let result: _.LoDashObjectWrapper<{}>; + result = _(any).plant<{}>({}); +} + /************** * Collection * **************/ diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index db2405580..7ec04214c 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2066,6 +2066,46 @@ declare module _ { commit(): TWrapper; } + //_.prototype.plant + interface LoDashWrapperBase { + /** + * Creates a clone of the chained sequence planting value as the wrapped value. + * @param value The value to plant as the wrapped value. + * @return Returns the new lodash wrapper instance. + */ + plant(value: number): LoDashWrapper; + + /** + * @see _.plant + */ + plant(value: string): LoDashStringWrapper; + + /** + * @see _.plant + */ + plant(value: boolean): LoDashWrapper; + + /** + * @see _.plant + */ + plant(value: number[]): LoDashNumberArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T[]): LoDashArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T): LoDashObjectWrapper; + + /** + * @see _.plant + */ + plant(value: any): LoDashWrapper; + } + /************** * Collection * **************/ From 8c900f86c78582ce6ea8213249f42be1d06f381d Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Mon, 14 Sep 2015 07:25:24 +0500 Subject: [PATCH 135/329] lodash: changed _.runInContext() method --- lodash/lodash-tests.ts | 11 ++++++++--- lodash/lodash.d.ts | 18 +++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index fc36241c5..a2ab359c8 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1768,9 +1768,6 @@ result = _([]).noop(true, 'a', 1); result = _({}).noop(true, 'a', 1); result = _(any).noop(true, 'a', 1); -var tempObject = {}; -result = _.runInContext(tempObject); - // _.property interface TestPropertyObject { a: { @@ -2084,6 +2081,14 @@ result = (_(TestMethodOfObject).methodOf(1, 2).value())(['a', '0 result = _({}).noConflict(); } +// _.runInContext +{ + let result: typeof _; + result = _.runInContext(); + result = _.runInContext({}); + result = _({}).runInContext(); +} + // _.uniqueId result = _.uniqueId(); result = _.uniqueId(''); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index db2405580..7c2f61574 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8552,11 +8552,19 @@ declare module _ { //_.runInContext interface LoDashStatic { /** - * Create a new lodash function using the given context object. - * @param context The context object - * @returns The lodash function. - **/ - runInContext(context: any): typeof _; + * Create a new pristine lodash function using the given context object. + * + * @param context The context object. + * @return Returns a new lodash function. + */ + runInContext(context?: Object): typeof _; + } + + interface LoDashObjectWrapper { + /** + * @see _.runInContext + */ + runInContext(): typeof _; } //_.times From 4fdf088f44c0fe61dcbaa853aad9d657bf24bdbc Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 16 Sep 2015 20:55:00 +0500 Subject: [PATCH 136/329] redis: export the interfaces --- redis/redis.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/redis/redis.d.ts b/redis/redis.d.ts index 0e0a0a8a0..79caa6aa3 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -16,25 +16,25 @@ declare module "redis" { export var debug_mode:boolean; - interface MessageHandler { - (channel:string, message:any): void; + export interface MessageHandler { + (channel:string, message:M): 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. + export 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 ResCallbackT { + export interface ResCallbackT { (err:Error, res:R): void; } - interface ServerInfo { + export interface ServerInfo { redis_version: string; versions: number[]; } - interface ClientOpts { + export interface ClientOpts { parser?: string; return_buffers?: boolean; detect_buffers?: boolean; @@ -51,7 +51,7 @@ declare module "redis" { command_queue_low_water?: number; } - interface RedisClient extends NodeJS.EventEmitter { + export interface RedisClient extends NodeJS.EventEmitter { // event: connect // event: error // event: message @@ -362,7 +362,7 @@ declare module "redis" { quit(...args:any[]): boolean; } - interface Multi { + export interface Multi { exec(callback?:ResCallbackT): boolean; get(args:any[], callback?:ResCallbackT): Multi; From de0d7f205e8cbb3127514f94708391d759660b5f Mon Sep 17 00:00:00 2001 From: tkqubo Date: Thu, 17 Sep 2015 06:00:34 +0900 Subject: [PATCH 137/329] Add gulp-svg-sprite --- gulp-svg-sprite/gulp-svg-sprite-tests.ts | 51 ++++++++++++++++++++++++ gulp-svg-sprite/gulp-svg-sprite.d.ts | 22 ++++++++++ svg-sprite/svg-sprite.d.ts | 4 +- 3 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 gulp-svg-sprite/gulp-svg-sprite-tests.ts create mode 100644 gulp-svg-sprite/gulp-svg-sprite.d.ts diff --git a/gulp-svg-sprite/gulp-svg-sprite-tests.ts b/gulp-svg-sprite/gulp-svg-sprite-tests.ts new file mode 100644 index 000000000..6c1ba71df --- /dev/null +++ b/gulp-svg-sprite/gulp-svg-sprite-tests.ts @@ -0,0 +1,51 @@ +/// +/// +/// + +import svgSprite = require('gulp-svg-sprite'); +import spriter = require('svg-sprite'); +import gulp = require('gulp') + +let config: spriter.Config; + +// Basic configuration example +config = { + mode : { + css : { // Activate the «css» mode + render : { + css : true // Activate CSS output (with default options) + } + } + } +}; + +gulp.src('**/*.svg', {cwd: 'path/to/assets'}) + .pipe(svgSprite(config)) + .pipe(gulp.dest('out')); + + +config = { + shape : { + dimension : { // Set maximum dimensions + maxWidth : 32, + maxHeight : 32 + }, + spacing : { // Add padding + padding : 10 + }, + dest : 'out/intermediate-svg' // Keep the intermediate files + }, + mode : { + view : { // Activate the «view» mode + bust : false, + render : { + scss : true // Activate Sass output (with default options) + } + }, + symbol : true // Activate the «symbol» mode + } +}; + +gulp.src('**/*.svg', {cwd: 'path/to/assets'}) + .pipe(svgSprite(config)) + .pipe(gulp.dest('out')); diff --git a/gulp-svg-sprite/gulp-svg-sprite.d.ts b/gulp-svg-sprite/gulp-svg-sprite.d.ts new file mode 100644 index 000000000..094c5e2eb --- /dev/null +++ b/gulp-svg-sprite/gulp-svg-sprite.d.ts @@ -0,0 +1,22 @@ +// Type definitions for gulp-svg-sprite +// Project: https://github.com/jkphl/gulp-svg-sprite +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "gulp-svg-sprite" { + import spriter = require('svg-sprite'); + + namespace svgSprite { + interface SvgSprite { + (options?: spriter.Config): NodeJS.ReadWriteStream; + } + } + + var svgSprite: svgSprite.SvgSprite; + + export = svgSprite; +} + diff --git a/svg-sprite/svg-sprite.d.ts b/svg-sprite/svg-sprite.d.ts index c319fb174..3030bc05a 100644 --- a/svg-sprite/svg-sprite.d.ts +++ b/svg-sprite/svg-sprite.d.ts @@ -291,12 +291,12 @@ declare module "svg-sprite" { * which all reside in the directory tmpl/css. Example: {css: true, scss: {dest: '_sprite.scss'}} * @default {} */ - render?: { [key: string]: RenderingConfiguration }; + render?: { [key: string]: RenderingConfiguration|boolean }; /** * Enabling this will trigger the creation of an HTML document demoing the usage of the sprite. Please see below for details on [rendering configurations](#rendering-configurations). * @default false */ - example?: RenderingConfiguration; + example?: RenderingConfiguration|boolean; /** * Specify svg-sprite which output mode to use with this configuration */ From 06d310cac577b8e4bfdbc2cd0e367e694029746a Mon Sep 17 00:00:00 2001 From: tkqubo Date: Thu, 17 Sep 2015 06:01:56 +0900 Subject: [PATCH 138/329] Add version --- gulp-svg-sprite/gulp-svg-sprite.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulp-svg-sprite/gulp-svg-sprite.d.ts b/gulp-svg-sprite/gulp-svg-sprite.d.ts index 094c5e2eb..50aa00362 100644 --- a/gulp-svg-sprite/gulp-svg-sprite.d.ts +++ b/gulp-svg-sprite/gulp-svg-sprite.d.ts @@ -1,4 +1,4 @@ -// Type definitions for gulp-svg-sprite +// Type definitions for gulp-svg-sprite 1.2.9 // Project: https://github.com/jkphl/gulp-svg-sprite // Definitions by: Qubo // Definitions: https://github.com/borisyankov/DefinitelyTyped From 813a3c7490049f6e66f63969a213aa902addb7a3 Mon Sep 17 00:00:00 2001 From: Shiak1 Date: Wed, 16 Sep 2015 19:07:05 -0400 Subject: [PATCH 139/329] Added formData to Options interface Fix issue #5787 --- request/request.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/request/request.d.ts b/request/request.d.ts index e261d3615..5332aa90a 100644 --- a/request/request.d.ts +++ b/request/request.d.ts @@ -62,6 +62,7 @@ declare module 'request' { uri?: string; callback?: (error: any, response: http.IncomingMessage, body: any) => void; jar?: any; // CookieJar + formData: any; // Object form?: any; // Object or string auth?: AuthOptions; oauth?: OAuthOptions; From b17b669edff5f7e05c8f054e004f78f00161300f Mon Sep 17 00:00:00 2001 From: David Pfeffer Date: Wed, 16 Sep 2015 19:17:42 -0400 Subject: [PATCH 140/329] Exposes ScopeScheduler to TypeScript --- rx-angular/rx.angular.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rx-angular/rx.angular.d.ts b/rx-angular/rx.angular.d.ts index e2d0ec8c5..413abf30b 100644 --- a/rx-angular/rx.angular.d.ts +++ b/rx-angular/rx.angular.d.ts @@ -12,6 +12,16 @@ declare module Rx { interface IObservable { safeApply($scope: ng.IScope, callback: (data: any) => void): Rx.Observable; } + + export interface ScopeScheduler extends IScheduler { + constructor(scope: ng.IScope); + } + + export interface ScopeSchedulerStatic extends SchedulerStatic { + new ($scope: angular.IScope): ScopeScheduler; + } + + export var ScopeScheduler: ScopeSchedulerStatic; } declare module rx.angular { From b1c0b5542da12ee4792d72740a1ce07516da23ab Mon Sep 17 00:00:00 2001 From: mfrantz Date: Wed, 16 Sep 2015 16:49:21 -0700 Subject: [PATCH 141/329] bluebird: Add 'each' --- bluebird/bluebird-tests.ts | 47 ++++++++++++++++++++++++++++++++++++++ bluebird/bluebird.d.ts | 17 ++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/bluebird/bluebird-tests.ts b/bluebird/bluebird-tests.ts index 2377da0d0..b8eecf2ca 100644 --- a/bluebird/bluebird-tests.ts +++ b/bluebird/bluebird-tests.ts @@ -550,6 +550,13 @@ fooArrProm = fooArrProm.filter((item: Foo) => { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +fooArrProm = fooArrProm.each((item: Foo): Bar => bar); +fooArrProm = fooArrProm.each((item: Foo, index: number): Bar => index ? bar : null); +fooArrProm = fooArrProm.each((item: Foo, index: number, arrayLength: number): Bar => bar); +fooArrProm = fooArrProm.each((item: Foo, index: number, arrayLength: number): Promise => barProm); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + fooProm = Promise.try(() => { return foo; @@ -1123,3 +1130,43 @@ fooArrProm = Promise.filter(fooArr, (item: Foo, index: number, arrayLength: numb }); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// each() + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooThenArrThen + +fooArrThen = Promise.each(fooThenArrThen, (item: Foo) => bar); +fooArrThen = Promise.each(fooThenArrThen, (item: Foo) => barThen); +fooArrThen = Promise.each(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => bar); +fooArrThen = Promise.each(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => barThen); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooArrThen + +fooArrThen = Promise.each(fooArrThen, (item: Foo) => bar); +fooArrThen = Promise.each(fooArrThen, (item: Foo) => barThen); +fooArrThen = Promise.each(fooArrThen, (item: Foo, index: number, arrayLength: number) => bar); +fooArrThen = Promise.each(fooArrThen, (item: Foo, index: number, arrayLength: number) => barThen); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooThenArr + +fooArrThen = Promise.each(fooThenArr, (item: Foo) => bar); +fooArrThen = Promise.each(fooThenArr, (item: Foo) => barThen); +fooArrThen = Promise.each(fooThenArr, (item: Foo, index: number, arrayLength: number) => bar); +fooArrThen = Promise.each(fooThenArr, (item: Foo, index: number, arrayLength: number) => barThen); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooArr + +fooArrThen = Promise.each(fooArr, (item: Foo) => bar); +fooArrThen = Promise.each(fooArr, (item: Foo) => barThen); +fooArrThen = Promise.each(fooArr, (item: Foo, index: number, arrayLength: number) => bar); +fooArrThen = Promise.each(fooArr, (item: Foo, index: number, arrayLength: number) => barThen); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index 543a2ef0a..dcf1a57a0 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -328,6 +328,11 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { filter(filterer: (item: U, index: number, arrayLength: number) => Promise.Thenable, options?: Promise.ConcurrencyOption): Promise; filter(filterer: (item: U, index: number, arrayLength: number) => boolean, options?: Promise.ConcurrencyOption): Promise; + /** + * Same as calling ``Promise.each(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + each(iterator: (item: R, index: number, arrayLength: number) => U | Promise.Thenable): Promise; + /** * Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise. * @@ -607,6 +612,18 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { // array with values static filter(values: R[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable, option?: Promise.ConcurrencyOption): Promise; static filter(values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; + + /** + * Iterate over an array, or a promise of an array, which contains promises (or a mix of promises and values) with the given iterator function with the signature (item, index, value) where item is the resolved value of a respective promise in the input array. Iteration happens in serially. If any promise in the input array is rejected the returned promise is rejected as well. + * + * Resolves to the original array unmodified, this method is meant to be used for side effects. If the iterator function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. + */ + // promise of array with promises of value + static each(values: Promise.Thenable[]>, iterator: (item: R, index: number, arrayLength: number) => U | Promise.Thenable): Promise; + // array with promises of value + static each(values: Promise.Thenable[], iterator: (item: R, index: number, arrayLength: number) => U | Promise.Thenable): Promise; + // array with values OR promise of array with values + static each(values: R[] | Promise.Thenable, iterator: (item: R, index: number, arrayLength: number) => U | Promise.Thenable): Promise; } declare module Promise { From 5fd34fe3e2ac3945694ebb08cc502fb61b510037 Mon Sep 17 00:00:00 2001 From: Stephen Lautier Date: Thu, 17 Sep 2015 01:53:52 +0200 Subject: [PATCH 142/329] added new property "typescript" within Params --- gulp-typescript/gulp-typescript.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/gulp-typescript/gulp-typescript.d.ts b/gulp-typescript/gulp-typescript.d.ts index da517a511..7b16d0a5a 100644 --- a/gulp-typescript/gulp-typescript.d.ts +++ b/gulp-typescript/gulp-typescript.d.ts @@ -23,6 +23,7 @@ declare module "gulp-typescript" { sourceRoot?: string; sortOutput?: boolean; target?: string; + typescript?: any; } interface Project { From d36fd3b0621c917cf5a7f5c1c6484cdd3003599e Mon Sep 17 00:00:00 2001 From: mfrantz Date: Wed, 16 Sep 2015 17:08:10 -0700 Subject: [PATCH 143/329] bluebird: Fix typo in 'each' comment copied from wiki This typo has since been fixed in the original document: https://github.com/petkaantonov/bluebird/blob/master/API.md#eachfunction-iterator---promise --- bluebird/bluebird.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index dcf1a57a0..350761fdd 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -614,7 +614,7 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { static filter(values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; /** - * Iterate over an array, or a promise of an array, which contains promises (or a mix of promises and values) with the given iterator function with the signature (item, index, value) where item is the resolved value of a respective promise in the input array. Iteration happens in serially. If any promise in the input array is rejected the returned promise is rejected as well. + * Iterate over an array, or a promise of an array, which contains promises (or a mix of promises and values) with the given iterator function with the signature (item, index, value) where item is the resolved value of a respective promise in the input array. Iteration happens serially. If any promise in the input array is rejected the returned promise is rejected as well. * * Resolves to the original array unmodified, this method is meant to be used for side effects. If the iterator function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. */ From bbea4851708111ea71a06d88cf2d0a11d7aaa4b8 Mon Sep 17 00:00:00 2001 From: Xiaohan Zhang Date: Wed, 16 Sep 2015 21:45:26 -0400 Subject: [PATCH 144/329] update photoswipe typings to 4.0.8 --- photoswipe/photoswipe-tests.ts | 3 ++- photoswipe/photoswipe.d.ts | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/photoswipe/photoswipe-tests.ts b/photoswipe/photoswipe-tests.ts index ca136f3a2..e4006d5c1 100644 --- a/photoswipe/photoswipe-tests.ts +++ b/photoswipe/photoswipe-tests.ts @@ -51,7 +51,8 @@ function test_defaultUI() { return el.tagName === 'A'; }, mainScrollEndFriction: 0.35, - panEndFriction: 0.35 + panEndFriction: 0.35, + modal: true }; var photoSwipe: PhotoSwipe; diff --git a/photoswipe/photoswipe.d.ts b/photoswipe/photoswipe.d.ts index 16ce87a68..bf1cf701b 100644 --- a/photoswipe/photoswipe.d.ts +++ b/photoswipe/photoswipe.d.ts @@ -1,4 +1,4 @@ -// Type definitions for PhotoSwipe 4.0.7 +// Type definitions for PhotoSwipe 4.0.8 // Project: http://photoswipe.com/ // Definitions by: Xiaohan Zhang // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -308,6 +308,13 @@ declare module PhotoSwipe { * } */ isClickableElement?: (el: HTMLElement) => boolean; + + /** + * Controls whether PhotoSwipe should expand to take up the entire viewport. + * If false, the PhotoSwipe element will take the size of the positioned parent of the template. Take a look at the FAQ for more + * information. + */ + modal?: boolean; } interface UIFramework { From 3251d88b3a375de5043e7aa47d2706579954ac2a Mon Sep 17 00:00:00 2001 From: Ritzlgrmft Date: Thu, 17 Sep 2015 11:02:48 +0200 Subject: [PATCH 145/329] naming convention fixed Travis errors fixed --- cordova-plugin-app-version/appversion.d.ts | 8 -------- ...ests.ts => cordova-plugin-app-version-tests.ts} | 4 ++-- .../cordova-plugin-app-version.d.ts | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 10 deletions(-) delete mode 100644 cordova-plugin-app-version/appversion.d.ts rename cordova-plugin-app-version/{appversion-tests.ts => cordova-plugin-app-version-tests.ts} (77%) create mode 100644 cordova-plugin-app-version/cordova-plugin-app-version.d.ts diff --git a/cordova-plugin-app-version/appversion.d.ts b/cordova-plugin-app-version/appversion.d.ts deleted file mode 100644 index 4069e38da..000000000 --- a/cordova-plugin-app-version/appversion.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -interface Cordova { - getAppVersion: { - getAppName: () => ng.IPromise; - getPackageName: () => ng.IPromise; - getVersionCode: () => ng.IPromise; - getVersionNumber: () => ng.IPromise; - }; -} \ No newline at end of file diff --git a/cordova-plugin-app-version/appversion-tests.ts b/cordova-plugin-app-version/cordova-plugin-app-version-tests.ts similarity index 77% rename from cordova-plugin-app-version/appversion-tests.ts rename to cordova-plugin-app-version/cordova-plugin-app-version-tests.ts index 89858c3e5..9f366dfb8 100644 --- a/cordova-plugin-app-version/appversion-tests.ts +++ b/cordova-plugin-app-version/cordova-plugin-app-version-tests.ts @@ -1,5 +1,5 @@ -/// -/// +/// +/// cordova.getAppVersion.getAppName() .then(appName=> { console.log(appName) diff --git a/cordova-plugin-app-version/cordova-plugin-app-version.d.ts b/cordova-plugin-app-version/cordova-plugin-app-version.d.ts new file mode 100644 index 000000000..8b99a9638 --- /dev/null +++ b/cordova-plugin-app-version/cordova-plugin-app-version.d.ts @@ -0,0 +1,14 @@ +/// +// Type definitions for cordova-plugin-app-version v0.1.7 +// Project: https://github.com/whiteoctober/cordova-plugin-app-version +// Definitions by: Markus Wagner +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface Cordova { + getAppVersion: { + getAppName: () => Q.IPromise; + getPackageName: () => Q.IPromise; + getVersionCode: () => Q.IPromise; + getVersionNumber: () => Q.IPromise; + }; +} \ No newline at end of file From de37ed0b7a7ffd8bf3bd1b5e1cd92acfb73e95df Mon Sep 17 00:00:00 2001 From: vvakame Date: Thu, 17 Sep 2015 18:10:57 +0900 Subject: [PATCH 146/329] bump tsc version to 1.6.2 --- npm-shrinkwrap.json | 18 +++++++++--------- package.json | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 3458cb8a6..711587001 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -8,9 +8,9 @@ "resolved": "https://registry.npmjs.org/definition-tester/-/definition-tester-0.2.0.tgz", "dependencies": { "bluebird": { - "version": "2.9.34", + "version": "2.10.0", "from": "bluebird@>=2.5.3 <3.0.0", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.9.34.tgz" + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.10.0.tgz" }, "definition-header": { "version": "0.1.0", @@ -23,9 +23,9 @@ "resolved": "https://registry.npmjs.org/joi/-/joi-4.9.0.tgz", "dependencies": { "hoek": { - "version": "2.14.0", + "version": "2.16.2", "from": "hoek@>=2.2.0 <3.0.0", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.14.0.tgz" + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.2.tgz" }, "topo": { "version": "1.0.3", @@ -33,9 +33,9 @@ "resolved": "https://registry.npmjs.org/topo/-/topo-1.0.3.tgz" }, "isemail": { - "version": "1.1.1", + "version": "1.2.0", "from": "isemail@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/isemail/-/isemail-1.1.1.tgz" + "resolved": "https://registry.npmjs.org/isemail/-/isemail-1.2.0.tgz" }, "moment": { "version": "2.10.6", @@ -305,9 +305,9 @@ } }, "typescript": { - "version": "1.6.0-beta", - "from": "typescript@1.6.0-beta", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.6.0-beta.tgz" + "version": "1.6.2", + "from": "typescript@1.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.6.2.tgz" } } } diff --git a/package.json b/package.json index e82eb15b0..b92031a38 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,6 @@ }, "devDependencies": { "definition-tester": "0.2.0", - "typescript": "1.6.0-beta" + "typescript": "1.6.2" } } From 0592895e0431d2f290a1330d0d78fd9cb4ece1e7 Mon Sep 17 00:00:00 2001 From: robert-voica Date: Thu, 17 Sep 2015 13:41:05 +0300 Subject: [PATCH 147/329] Updated bootstrap-notify to v3.1.3 --- bootstrap-notify/bootstrap-notify-test.ts | 51 ++++++++++ bootstrap-notify/bootstrap-notify.d.ts | 109 ++++++++++------------ 2 files changed, 101 insertions(+), 59 deletions(-) create mode 100644 bootstrap-notify/bootstrap-notify-test.ts diff --git a/bootstrap-notify/bootstrap-notify-test.ts b/bootstrap-notify/bootstrap-notify-test.ts new file mode 100644 index 000000000..09e1dba1e --- /dev/null +++ b/bootstrap-notify/bootstrap-notify-test.ts @@ -0,0 +1,51 @@ +/// +/// + +//Test for bootstrap-notify v3.1.3 + +$.notify({ + // options + icon: 'glyphicon glyphicon-warning-sign', + title: 'Bootstrap notify', + message: 'Turning standard Bootstrap alerts into "notify" like notifications', + url: 'https://github.com/mouse0270/bootstrap-notify', + target: '_blank' +},{ + // settings + element: 'body', + position: null, + type: "info", + allow_dismiss: true, + newest_on_top: false, + showProgressbar: false, + placement: { + from: "top", + align: "right" + }, + offset: 20, + spacing: 10, + z_index: 1031, + delay: 5000, + timer: 1000, + url_target: '_blank', + mouse_over: null, + animate: { + enter: 'animated fadeInDown', + exit: 'animated fadeOutUp' + }, + onShow: null, + onShown: null, + onClose: null, + onClosed: null, + icon_type: 'class', + template: '' +}); \ No newline at end of file diff --git a/bootstrap-notify/bootstrap-notify.d.ts b/bootstrap-notify/bootstrap-notify.d.ts index 2159aa21a..556bf6137 100644 --- a/bootstrap-notify/bootstrap-notify.d.ts +++ b/bootstrap-notify/bootstrap-notify.d.ts @@ -1,68 +1,59 @@ -// Type definitions for bootstrap-notify -// Project: https://github.com/Nijikokun/bootstrap-notify -// Definitions by: Blake Niemyjski -// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Type definitions for bootstrap-notify v3.1.3 -/// +/// -interface NotifyOptions { - /** - Alert style, omit alert- from style name. - @param {string} type - */ - type?: string; - /** - Allow alert to be closable through a close icon. - @param {boolean} closable - */ - closable?: boolean; - /** - Alert transition, pretty sure only fade is supported, you can try others if you wish. - @param {string} transition - */ - transition?: string; - /** - Fade alert out after a certain delay (in ms) - @param {string} fadeOut - */ - fadeOut?: NotifyFadeOutSettings; - /** - Text to show on alert, you can use either html or text. HTML will override text. - @param {MessageOptions} message - */ - message?: MessageOptions; - /** - Called before alert closes. - @param {function} onClose - */ - onClose?: () => void; - /** - Called after alert closes. - @param {function} onClosed - */ - onClosed?: () => void; +/* tslint:disable: interface-name no-any */ + +interface JQueryStatic { + /* tslint:enable: interface-name */ + notify(message: string): INotifyReturn; + notify(opts: INotifyOptions, settings?: INotifySettings): INotifyReturn; + notifyDefaults(settings: INotifySettings): void; + notifyClose(): void; + notifyClose(command: string): void; } -interface NotifyFadeOutSettings { - enabled?: boolean; - delay?: number; +interface INotifyOptions { + message: string; + title?: string; + icon?: string; + url?: string; + target?: string; } -interface MessageOptions { - html?: string; - text?: string; +interface INotifySettings { + element?: string; + position?: string; + type?: string; + allow_dismiss?: boolean; + allow_duplicates?: boolean; + newest_on_top?: boolean; + showProgressbar?: boolean; + placement?: { + from?: string; + align?: string; + }; + offset?: number; + spacing?: number; + z_index?: number; + delay?: number; + timer?: number; + url_target?: string; + mouse_over?: string; + animate?: { + enter?: string; + exit?: string; + }; + onShow?: () => void; + onShown?: () => void; + onClose?: () => void; + onClosed?: () => void; + icon_type?: string; + template?: string; } -interface Notification { - show(); - hide(); -} - -interface JQuery { - /** - Creates a notification instance with default options. - @constructor - @param {NotifyOptions} options - */ - notify(options: NotifyOptions): Notification; +interface INotifyReturn { + $ele: JQueryStatic; + close: () => void; + update: (command: string, update: any) => void; } \ No newline at end of file From 79b6ebd0e9eb25625379fe1e1e19ac939283475d Mon Sep 17 00:00:00 2001 From: robert-voica Date: Thu, 17 Sep 2015 13:55:26 +0300 Subject: [PATCH 148/329] Repaired header --- bootstrap-notify/bootstrap-notify-test.ts | 1 + bootstrap-notify/bootstrap-notify.d.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/bootstrap-notify/bootstrap-notify-test.ts b/bootstrap-notify/bootstrap-notify-test.ts index 09e1dba1e..a71a83557 100644 --- a/bootstrap-notify/bootstrap-notify-test.ts +++ b/bootstrap-notify/bootstrap-notify-test.ts @@ -2,6 +2,7 @@ /// //Test for bootstrap-notify v3.1.3 +//Copied example directly from Bootstrap-notify site $.notify({ // options diff --git a/bootstrap-notify/bootstrap-notify.d.ts b/bootstrap-notify/bootstrap-notify.d.ts index 556bf6137..dc08354d9 100644 --- a/bootstrap-notify/bootstrap-notify.d.ts +++ b/bootstrap-notify/bootstrap-notify.d.ts @@ -1,4 +1,7 @@ // Type definitions for bootstrap-notify v3.1.3 +// Project: http://bootstrap-notify.remabledesigns.com/ +// Definitions by: Robert McIntosh , Robert Voica +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// From 03f5ce9a40dcc719f681faa02b68cf61bd123a25 Mon Sep 17 00:00:00 2001 From: Matias Emanuel Surdi Date: Thu, 17 Sep 2015 13:01:57 +0200 Subject: [PATCH 149/329] Add noTimestamp option --- jsonwebtoken/jsonwebtoken.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/jsonwebtoken/jsonwebtoken.d.ts b/jsonwebtoken/jsonwebtoken.d.ts index 9f0baef2b..205970f6a 100644 --- a/jsonwebtoken/jsonwebtoken.d.ts +++ b/jsonwebtoken/jsonwebtoken.d.ts @@ -27,6 +27,7 @@ declare module "jsonwebtoken" { audience?: string; subject?: string; issuer?: string; + noTimestamp?: boolean; } export interface VerifyOptions { From 781e4c294d0721cf31344e721e0107d307c1a66b Mon Sep 17 00:00:00 2001 From: Ritzlgrmft Date: Thu, 17 Sep 2015 14:51:02 +0200 Subject: [PATCH 150/329] Travis errors fixed --- .../cordova-plugin-app-version-tests.ts | 3 ++- cordova-plugin-app-version/cordova-plugin-app-version.d.ts | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cordova-plugin-app-version/cordova-plugin-app-version-tests.ts b/cordova-plugin-app-version/cordova-plugin-app-version-tests.ts index 9f366dfb8..3b27435bd 100644 --- a/cordova-plugin-app-version/cordova-plugin-app-version-tests.ts +++ b/cordova-plugin-app-version/cordova-plugin-app-version-tests.ts @@ -1,5 +1,6 @@ /// -/// +/// + cordova.getAppVersion.getAppName() .then(appName=> { console.log(appName) diff --git a/cordova-plugin-app-version/cordova-plugin-app-version.d.ts b/cordova-plugin-app-version/cordova-plugin-app-version.d.ts index 8b99a9638..a754368e3 100644 --- a/cordova-plugin-app-version/cordova-plugin-app-version.d.ts +++ b/cordova-plugin-app-version/cordova-plugin-app-version.d.ts @@ -1,9 +1,10 @@ -/// -// Type definitions for cordova-plugin-app-version v0.1.7 +// Type definitions for cordova-plugin-app-version v0.1.7 // Project: https://github.com/whiteoctober/cordova-plugin-app-version // Definitions by: Markus Wagner // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + interface Cordova { getAppVersion: { getAppName: () => Q.IPromise; From 87d055979089cb5c498672d63ef6e1a8f725b6e9 Mon Sep 17 00:00:00 2001 From: benliddicott Date: Thu, 17 Sep 2015 14:18:23 +0100 Subject: [PATCH 151/329] EJS Typing --- ejs/ejs-tests.ts | 4 +++ ejs/ejs.d.ts | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 ejs/ejs-tests.ts create mode 100644 ejs/ejs.d.ts diff --git a/ejs/ejs-tests.ts b/ejs/ejs-tests.ts new file mode 100644 index 000000000..fd03dd1e0 --- /dev/null +++ b/ejs/ejs-tests.ts @@ -0,0 +1,4 @@ +/// +import ejs = require("ejs"); +var people = ['geddy', 'neil', 'alex']; +var html = ejs.render('<%= people.join(", "); %>', { people: people }); diff --git a/ejs/ejs.d.ts b/ejs/ejs.d.ts new file mode 100644 index 000000000..95ca168c3 --- /dev/null +++ b/ejs/ejs.d.ts @@ -0,0 +1,91 @@ +// Type definitions for ejs.js v2.3.3 +// Project: http://ejs.co/ +// Definitions by: Ben Liddicott +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module "ejs" { + module Ejs { + type Data = { [name: string]: any }; + type Dependencies = string[]; + var cache: Cache; + var localsName: string; + function resolveInclude(name: string, filename: string): string; + function compile(template: string, opts?: Options): (TemplateFunction); + function render(template: string, data?: Data, opts?: Options): string; + function renderFile(path: string, data?: Data, opts?: Options, cb?: Function): any;// TODO RenderFileCallback return type + function clearCache(): any; + + function TemplateFunction(data: Data): any; + interface TemplateFunction { + dependencies: Dependencies; + } + interface Options { + cache?: any; + filename?: string; + context?: any; + compileDebug?: boolean; + client?: boolean; + delimiter?: string; + debug?: any; + _with?: boolean; + } + class Template { + constructor(text: string, opts: Options); + opts: Options; + templateText: string; + mode: string; + truncate: boolean; + currentLine: number; + source: string; + dependencies: Dependencies; + createRegex(): RegExp; + compile(): TemplateFunction; + generateSource(): any; + parseTemplateText(): string[]; + scanLine(line: string): any; + + } + module Template { + interface MODES { + EVAL: string; + ESCAPED: string; + RAW: string; + COMMENT: string; + LITERAL: string; + } + } + function escapeRegexChars(s: string): string; + function escapeXML(markup: string): string; + function shallowCopy(to: T1, fro: any): T1; + interface Cache { + _data: { [name: string]: any }; + set(key: string, val: any); + get(key: string): any; + } + var cache: Cache; + function resolve(from1: string, to: string): string; + function resolve(from1: string, from2: string, to: string): string; + function resolve(from1: string, from2: string, from3: string, to: string): string; + function resolve(from1: string, from2: string, from3: string, from4: string, to: string): string; + function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, to: string): string; + function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, to: string): string; + function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, to: string): string; + function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, from8: string, to: string): string; + function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, from8: string, from9: string, to: string): string; + function resolve(...args: string[]): string; + function normalize(path: string): string; + function isAbsolute(path: string): boolean; + function join(...args: string[]): string; + function relative(from: string, to: string): string; + var sep: string; + var delimiter: string; + function dirname(path: string): string; + function basename(path: string): string; + function extname(path: string): string; + function filter(xs: any, f: any): any; // TODO WHUT? + + + } + export = Ejs; +} \ No newline at end of file From d2f21a1d08fe25cbcb2ddf2b27f57a688391cb9c Mon Sep 17 00:00:00 2001 From: benliddicott Date: Sat, 15 Aug 2015 11:26:16 +0100 Subject: [PATCH 152/329] 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 89456dbce061106c41a01549ae703f0be8c27f98 Mon Sep 17 00:00:00 2001 From: benliddicott Date: Thu, 17 Sep 2015 14:18:23 +0100 Subject: [PATCH 153/329] EJS Typing --- ejs/ejs-tests.ts | 4 +++ ejs/ejs.d.ts | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 ejs/ejs-tests.ts create mode 100644 ejs/ejs.d.ts diff --git a/ejs/ejs-tests.ts b/ejs/ejs-tests.ts new file mode 100644 index 000000000..fd03dd1e0 --- /dev/null +++ b/ejs/ejs-tests.ts @@ -0,0 +1,4 @@ +/// +import ejs = require("ejs"); +var people = ['geddy', 'neil', 'alex']; +var html = ejs.render('<%= people.join(", "); %>', { people: people }); diff --git a/ejs/ejs.d.ts b/ejs/ejs.d.ts new file mode 100644 index 000000000..95ca168c3 --- /dev/null +++ b/ejs/ejs.d.ts @@ -0,0 +1,91 @@ +// Type definitions for ejs.js v2.3.3 +// Project: http://ejs.co/ +// Definitions by: Ben Liddicott +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module "ejs" { + module Ejs { + type Data = { [name: string]: any }; + type Dependencies = string[]; + var cache: Cache; + var localsName: string; + function resolveInclude(name: string, filename: string): string; + function compile(template: string, opts?: Options): (TemplateFunction); + function render(template: string, data?: Data, opts?: Options): string; + function renderFile(path: string, data?: Data, opts?: Options, cb?: Function): any;// TODO RenderFileCallback return type + function clearCache(): any; + + function TemplateFunction(data: Data): any; + interface TemplateFunction { + dependencies: Dependencies; + } + interface Options { + cache?: any; + filename?: string; + context?: any; + compileDebug?: boolean; + client?: boolean; + delimiter?: string; + debug?: any; + _with?: boolean; + } + class Template { + constructor(text: string, opts: Options); + opts: Options; + templateText: string; + mode: string; + truncate: boolean; + currentLine: number; + source: string; + dependencies: Dependencies; + createRegex(): RegExp; + compile(): TemplateFunction; + generateSource(): any; + parseTemplateText(): string[]; + scanLine(line: string): any; + + } + module Template { + interface MODES { + EVAL: string; + ESCAPED: string; + RAW: string; + COMMENT: string; + LITERAL: string; + } + } + function escapeRegexChars(s: string): string; + function escapeXML(markup: string): string; + function shallowCopy(to: T1, fro: any): T1; + interface Cache { + _data: { [name: string]: any }; + set(key: string, val: any); + get(key: string): any; + } + var cache: Cache; + function resolve(from1: string, to: string): string; + function resolve(from1: string, from2: string, to: string): string; + function resolve(from1: string, from2: string, from3: string, to: string): string; + function resolve(from1: string, from2: string, from3: string, from4: string, to: string): string; + function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, to: string): string; + function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, to: string): string; + function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, to: string): string; + function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, from8: string, to: string): string; + function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, from8: string, from9: string, to: string): string; + function resolve(...args: string[]): string; + function normalize(path: string): string; + function isAbsolute(path: string): boolean; + function join(...args: string[]): string; + function relative(from: string, to: string): string; + var sep: string; + var delimiter: string; + function dirname(path: string): string; + function basename(path: string): string; + function extname(path: string): string; + function filter(xs: any, f: any): any; // TODO WHUT? + + + } + export = Ejs; +} \ No newline at end of file From e9cc82ad94e783336c3cb82556dc8bdf62709be3 Mon Sep 17 00:00:00 2001 From: Ritzlgrmft Date: Thu, 17 Sep 2015 15:49:54 +0200 Subject: [PATCH 154/329] Internal logger logLog added --- log4javascript/log4javascript-tests.ts | 6 ++- log4javascript/log4javascript.d.ts | 60 +++++++++++++++----------- 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/log4javascript/log4javascript-tests.ts b/log4javascript/log4javascript-tests.ts index 7d55c3891..c3b77c5b6 100644 --- a/log4javascript/log4javascript-tests.ts +++ b/log4javascript/log4javascript-tests.ts @@ -1,4 +1,4 @@ -/// +/// function aSimpleLoggingMessageString() { var log = log4javascript.getDefaultLogger(); @@ -47,4 +47,8 @@ function changingTheFormatOfLogMessages() { var popUpAppender = new log4javascript.PopUpAppender(); var layout = new log4javascript.PatternLayout("[%-5p] %m"); popUpAppender.setLayout(layout); +} + +function configureLogLog() { + log4javascript.logLog.setQuietMode(true); } \ No newline at end of file diff --git a/log4javascript/log4javascript.d.ts b/log4javascript/log4javascript.d.ts index 98f23d1f7..44d226d0b 100644 --- a/log4javascript/log4javascript.d.ts +++ b/log4javascript/log4javascript.d.ts @@ -1051,38 +1051,46 @@ declare module log4javascript { // #region log4javascript error handling /** - * Sets whether LogLog is in quiet mode or not. In quiet mode, no messages sent to LogLog have any visible effect. By default, - * quiet mode is switched off. - * @param quietMode Whether to turn quiet mode on or off. + * log4javascript has a single rudimentary logger-like object of its own to handle messages generated by log4javascript itself. + * This logger is called logLog and is accessed via log4javascript.logLog. */ - export function setQuietMode(quietMode: boolean): void; + export namespace logLog { - /** - * Sets how many errors LogLog will display alerts for. By default, only the first error encountered generates an alert to the - * user. If you turn all errors on by supplying true to this method then all errors will generate alerts. - * @param showAllErrors Whether to show all errors or just the first. - */ - export function setAlertAllErrors(alertAllErrors: boolean): void; + /** + * Sets whether logLog is in quiet mode or not. In quiet mode, no messages sent to logLog have any visible effect. By default, + * quiet mode is switched off. + * @param quietMode Whether to turn quiet mode on or off. + */ + export function setQuietMode(quietMode: boolean): void; - /** - * Logs a debugging message to an in-memory list. - */ - export function debug(message: string, exception?: Error): void; + /** + * Sets how many errors logLog will display alerts for. By default, only the first error encountered generates an alert to the + * user. If you turn all errors on by supplying true to this method then all errors will generate alerts. + * @param showAllErrors Whether to show all errors or just the first. + */ + export function setAlertAllErrors(alertAllErrors: boolean): void; - /** - * Displays an alert of all debugging messages. - */ - export function displayDebug(): void; + /** + * Logs a debugging message to an in-memory list. + */ + export function debug(message: string, exception?: Error): void; - /** - * Currently has no effect. - */ - export function warn(message: string, exception?: Error): void; + /** + * Displays an alert of all debugging messages. + */ + export function displayDebug(): void; - /** - * Generates an alert to the user if and only if the error is the first one encountered and setAlertAllErrors(true) has not been called. - */ - export function error(message: string, exception?: Error): void; + /** + * Currently has no effect. + */ + export function warn(message: string, exception?: Error): void; + + /** + * Generates an alert to the user if and only if the error is the first one encountered and setAlertAllErrors(true) has not been called. + */ + export function error(message: string, exception?: Error): void; + + } // #endregion } From 64f0e13df830ca820116e794e71f7eee8fa19641 Mon Sep 17 00:00:00 2001 From: kpisaksen Date: Thu, 17 Sep 2015 16:16:23 +0200 Subject: [PATCH 155/329] Correcting array error When I added string array to the path parameter on use, I accidentally added ErrorRequestHandler array too. It's not removed. --- express/express.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/express/express.d.ts b/express/express.d.ts index 973d45fc7..e2f6d5df2 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -107,7 +107,7 @@ declare module "express" { use(path: string, ...handler: RequestHandler[]): T; use(path: string, handler: ErrorRequestHandler): T; use(path: string[], ...handler: RequestHandler[]): T; - use(path: string[], handler: ErrorRequestHandler[]): T; + use(path: string[], handler: ErrorRequestHandler): T; } export function Router(options?: any): Router; From c3bb5bb17e0aac32c386b2ed11aa4d334b0f374b Mon Sep 17 00:00:00 2001 From: Ritzlgrmft Date: Thu, 17 Sep 2015 16:31:15 +0200 Subject: [PATCH 156/329] Definitions for cordova-plugin-ibeacon added --- .../cordova-plugin-ibeacon-tests.ts | 62 ++++++++++++ .../cordova-plugin-ibeacon.d.ts | 95 +++++++++++++++++++ 2 files changed, 157 insertions(+) create mode 100644 cordova-plugin-ibeacon/cordova-plugin-ibeacon-tests.ts create mode 100644 cordova-plugin-ibeacon/cordova-plugin-ibeacon.d.ts diff --git a/cordova-plugin-ibeacon/cordova-plugin-ibeacon-tests.ts b/cordova-plugin-ibeacon/cordova-plugin-ibeacon-tests.ts new file mode 100644 index 000000000..7520c39d5 --- /dev/null +++ b/cordova-plugin-ibeacon/cordova-plugin-ibeacon-tests.ts @@ -0,0 +1,62 @@ +/// +/// + +function registerDelegates() { + cordova.plugins.locationManager.enableDebugLogs(); + + cordova.plugins.locationManager.delegate.didRangeBeaconsInRegion = (pluginResult) => didRangeBeaconsInRegion(pluginResult); + cordova.plugins.locationManager.delegate.didEnterRegion = (pluginResult) => didEnterRegion(pluginResult); + cordova.plugins.locationManager.delegate.didExitRegion = (pluginResult) => didExitRegion(pluginResult); + cordova.plugins.locationManager.delegate.didDetermineStateForRegion = (pluginResult) => didDetermineStateForRegion(pluginResult); + cordova.plugins.locationManager.delegate.didChangeAuthorizationStatus = (authorizationStatus) => didChangeAuthorizationStatus(authorizationStatus); + cordova.plugins.locationManager.delegate.didStartMonitoringForRegion = (pluginResult) => didStartMonitoringForRegion(pluginResult); + cordova.plugins.locationManager.delegate.monitoringDidFailForRegionWithError = (pluginResult) => monitoringDidFailForRegionWithError(pluginResult); + + cordova.plugins.locationManager.onDomDelegateReady(); +} + +function didRangeBeaconsInRegion(pluginResult: BeaconPlugin.PluginResult): void { + for (var beacon of pluginResult.beacons) { + console.log(beacon.uuid, beacon.major, beacon.minor, beacon.accuracy, beacon.proximity, beacon.rssi, beacon.tx); + } +} + +function didEnterRegion(pluginResult: BeaconPlugin.PluginResult): void { + var region: BeaconPlugin.Region = new cordova.plugins.locationManager.BeaconRegion("identifier", "uuid", 1, 2);; + cordova.plugins.locationManager.startRangingBeaconsInRegion(this.createBeaconRegionFromPluginResult(pluginResult)) + .then(() => { + console.log("startRangingBeaconsInRegion succeeded"); + }) + .catch((reason: any) => { + console.error("startRangingBeaconsInRegion failed: " + reason); + }); +} + +function didExitRegion(pluginResult: BeaconPlugin.PluginResult): void { + var region: BeaconPlugin.Region; + cordova.plugins.locationManager.stopRangingBeaconsInRegion(region) + .then(() => { + console.log("stopRangingBeaconsInRegion succeeded"); + }) + .catch((reason: any) => { + console.error("stopRangingBeaconsInRegion failed: " + reason); + }); +} + +function didDetermineStateForRegion(pluginResult: BeaconPlugin.PluginResult): void { + if (pluginResult.state === "CLRegionStateInside") { + console.log(pluginResult.region.identifier); + } +} + +function didChangeAuthorizationStatus(authorizationStatus: string): void { + console.log(authorizationStatus); +} + +function didStartMonitoringForRegion(pluginResult: BeaconPlugin.PluginResult): void { + console.log(pluginResult.region.identifier); +} + +function monitoringDidFailForRegionWithError(pluginResult: BeaconPlugin.PluginResult): void { + console.log(pluginResult.region.identifier); +} \ No newline at end of file diff --git a/cordova-plugin-ibeacon/cordova-plugin-ibeacon.d.ts b/cordova-plugin-ibeacon/cordova-plugin-ibeacon.d.ts new file mode 100644 index 000000000..8f1f6af1a --- /dev/null +++ b/cordova-plugin-ibeacon/cordova-plugin-ibeacon.d.ts @@ -0,0 +1,95 @@ +// Type definitions for cordova-plugin-ibeacon v3.3.0 +// Project: https://github.com/petermetz/cordova-plugin-ibeacon +// Definitions by: Markus Wagner +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface CordovaPlugins { + locationManager: BeaconPlugin.LocationManager; +} + +declare module BeaconPlugin { + /** + * Beacon Plugin. + */ + export interface LocationManager { + delegate: Delegate; + BeaconRegion: BeaconRegion; + onDomDelegateReady(): void; + startMonitoringForRegion(region: Region): Q.Promise; + stopMonitoringForRegion(region: Region): Q.Promise; + requestStateForRegion(region: Region): Q.Promise; + startRangingBeaconsInRegion(region: Region): Q.Promise; + stopRangingBeaconsInRegion(region: Region): Q.Promise; + getAuthorizationStatus(): Q.Promise; + requestWhenInUseAuthorization(): Q.Promise; + requestAlwaysAuthorization(): Q.Promise; + getMonitoredRegions(): Q.Promise; + getRangedRegions(): Q.Promise; + isRangingAvailable(): Q.Promise; + isMonitoringAvailableForClass(region: Region): Q.Promise; + startAdvertising(region: Region, measuredPower: boolean): Q.Promise; + stopAdvertising(): Q.Promise; + isAdvertisingAvailable(): Q.Promise; + isAdvertising(): Q.Promise; + disableDebugLogs(): Q.Promise; + enableDebugNotifications(): Q.Promise; + disableDebugNotifications(): Q.Promise; + enableDebugLogs(): Q.Promise; + isBluetoothEnabled(): Q.Promise; + enableBluetooth(): Q.Promise; + disableBluetooth(): Q.Promise; + appendToDeviceLog(message: string): Q.Promise; + } + + export interface PluginResult { + eventType: string; + region: Region; + beacons: Beacon[]; + authorizationStatus: string; + state: string; + } + + export interface Delegate { + didDetermineStateForRegion(pluginResult: PluginResult): void; + didStartMonitoringForRegion(pluginResult: PluginResult): void; + didExitRegion(pluginResult: PluginResult): void; + didEnterRegion(pluginResult: PluginResult): void; + didRangeBeaconsInRegion(pluginResult: PluginResult): void; + peripheralManagerDidStartAdvertising(pluginResult: PluginResult): void; + peripheralManagerDidUpdateState(pluginResult: PluginResult): void; + didChangeAuthorizationStatus(authorizationStatus: string): void; + monitoringDidFailForRegionWithError(pluginResult: PluginResult): void; + } + + export interface Region { + identifier: string; + new (identifier: string): Region; + } + + export interface BeaconRegion extends Region { + uuid: string; + major: string; + minor: string; + notifyEntryStateOnDisplay: boolean; + new (identifier: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion; + } + + export interface CircularRegion extends Region { + latitude: number; + longitude: number; + radius: number; + new (identifier: string, latitude: number, longitude: number, radius: number): CircularRegion; + } + + export interface Beacon { + uuid: string; + major: string; + minor: string; + proximity: string; + tx: number; + rssi: number; + accuracy: number; + } +} From 8b36b63838077369de2eea584136c991bfb09393 Mon Sep 17 00:00:00 2001 From: benliddicott Date: Thu, 17 Sep 2015 15:46:41 +0100 Subject: [PATCH 157/329] add static-eval --- static-eval/static-eval-tests.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 static-eval/static-eval-tests.ts diff --git a/static-eval/static-eval-tests.ts b/static-eval/static-eval-tests.ts new file mode 100644 index 000000000..5657a8c62 --- /dev/null +++ b/static-eval/static-eval-tests.ts @@ -0,0 +1,14 @@ +/// +/// + +import evaluate = require('static-eval'); +import parse = require('../esprima/esprima').parse; + +var src = '[1,2,3+4*10+n,foo(3+5),obj[""+"x"].y]'; +var ast = parse(src).body[0].expression; + +console.log(evaluate(ast, { + n: 6, + foo: function (x) { return x * 100 }, + obj: { x: { y: 555 } } +})); \ No newline at end of file From d464f5a4e10431a5f47e89666c933ff7a72d8313 Mon Sep 17 00:00:00 2001 From: benliddicott Date: Thu, 17 Sep 2015 15:51:30 +0100 Subject: [PATCH 158/329] Updated header --- static-eval/static-eval.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/static-eval/static-eval.d.ts b/static-eval/static-eval.d.ts index 61db0b405..bb3461ad6 100644 --- a/static-eval/static-eval.d.ts +++ b/static-eval/static-eval.d.ts @@ -1,4 +1,10 @@ -declare module 'static-eval' { +// Type definitions for static-eval v0.2.4 +// Project: https://github.com/substack/static-eval +// Definitions by: Ben Liddicott +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module 'static-eval' { function evaluate(ast, vars: { [name: string]: any }); export =evaluate; } From bf220bcf37b916fe838533dd6150212259d00e32 Mon Sep 17 00:00:00 2001 From: Ralf Sternberg Date: Thu, 17 Sep 2015 17:09:37 +0200 Subject: [PATCH 159/329] Add typescript definitions for Tabris.js --- tabris/README.md | 8 + tabris/tabris-tests.ts | 302 +++++++++ tabris/tabris.d.ts | 1446 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1756 insertions(+) create mode 100644 tabris/README.md create mode 100644 tabris/tabris-tests.ts create mode 100644 tabris/tabris.d.ts diff --git a/tabris/README.md b/tabris/README.md new file mode 100644 index 000000000..23d3d1a49 --- /dev/null +++ b/tabris/README.md @@ -0,0 +1,8 @@ +# TypeScript definitions for Tabris.js + +[Tabris.js](http://tabrisjs.com) is a framework for developing mobile apps with native UIs in JavaScript. +The JavaScript library is available on [npm](https://www.npmjs.com/package/tabris). + +Current supported version is 1.2. + +See http://definitelytyped.org/guides/contributing.html diff --git a/tabris/tabris-tests.ts b/tabris/tabris-tests.ts new file mode 100644 index 000000000..28ab53cec --- /dev/null +++ b/tabris/tabris-tests.ts @@ -0,0 +1,302 @@ +/// + +var page = tabris.create("Page", {}); + +function test_events() { + var listener = () => console.log("triggered"); + var widget = tabris.create("Composite", {}); + widget.on("foo", listener); + widget.trigger("foo", "details"); + widget.off("foo", listener); + widget.off("foo"); + widget.off(null, listener); + widget.off(); +} + +function test_Action() { + var widget: tabris.Action = tabris.create("Action", {}); + widget.set("foo", 23); + widget.set({ + image: {src: "http://example.org"}, + title: "foo", + placementPriority: "high" + }); + var self: tabris.Action = widget.on("event", function(widget: tabris.Action) {}); +} + +function test_Button() { + var widget: tabris.Button = tabris.create("Button", {}); + widget.set("foo", 23); + widget.set({ + width: 200, + height: 400, + alignment: "center", + image: {src: "http://example.org"}, + text: "foo" + }); +} + +function test_CheckBox() { + var widget: tabris.CheckBox = tabris.create("CheckBox", {}); + widget.set("foo", 23); + widget.set({ + selection: true, + text: "foo" + }); +} + +function test_Canvas() { + var widget: tabris.Canvas = tabris.create("Canvas", {}); + widget.set("foo", 23); + widget.set({ + }); + var ctx: tabris.CanvasContext = widget.getContext("2d", 200, 300); +} + +function test_Cell() { + var widget: tabris.Cell = tabris.create("Cell", {}); + widget.set("foo", 23); + widget.set({ + }); +} + +function test_CollectionView() { + var widget: tabris.CollectionView = tabris.create("CollectionView", {}); + widget.set("foo", 23); + widget.set({ + cellType: (item: any) => "foo", + initializeCell: (cell: tabris.Cell, type: string) => {}, + itemHeight: (item: any, type: string) => 23, + items: ["foo", "bar", "baz"], + refreshEnabled: true, + refreshIndicator: true, + refreshMessage: "foo" + }); + widget.insert(["item1", "item2"]); + widget.insert(["item1", "item2"], 3); + widget.refresh(); + widget.refresh(3); + widget.remove(3); + widget.remove(3, 2); + widget.reveal(23); +} + +function test_Composite() { + var widget: tabris.Composite = tabris.create("Composite", {}); + widget.set("foo", 23); + widget.set({ + }); +} + +function test_Drawer() { + var widget: tabris.Drawer = tabris.create("Drawer", {}); + widget.set("foo", 23); + widget.set({ + }); + var same: tabris.Drawer = widget.open(); + var same: tabris.Drawer = widget.close(); +} + +function test_ImageView() { + var widget: tabris.ImageView = tabris.create("ImageView", {}); + widget.set("foo", 23); + widget.set({ + image: {src: "http://example.com"}, + scaleMode: "auto" + }); +} + +function test_Page() { + var page: tabris.Page = tabris.create("Page", {}); + page.set("foo", 23); + page.set({ + image: {src: "http://example.com"}, + title: "foo", + topLevel: true + }); + page.open().close(); +} + +function test_PageSelector() { + var widget: tabris.PageSelector = tabris.create("PageSelector", {}); + widget.set("foo", 23); + widget.set({ + }); +} + +function test_Picker() { + var widget: tabris.Picker = tabris.create("Picker", {}); + widget.set("foo", 23); + widget.set({ + selection: "foo", + selectionIndex: 23, + items: ["foo", "bar", "baz"] + }); +} + +function test_ProgressBar() { + var widget: tabris.ProgressBar = tabris.create("ProgressBar", {}); + widget.set("foo", 23); + widget.set({ + minimum: 0, + maximum: 100, + selection: 23, + state: "normal" + }); +} + +function test_RadioButton() { + var widget: tabris.RadioButton = tabris.create("RadioButton", {}); + widget.set("foo", 23); + widget.set({ + selection: true, + text: "foo" + }); +} + +function test_ScrollView() { + var widget: tabris.ScrollView = tabris.create("ScrollView", {}); + widget.set("foo", 23); + widget.set({ + direction: "horizontal" + }); +} + +function test_SearchAction() { + var widget: tabris.SearchAction = tabris.create("SearchAction", {}); + widget.set("foo", 23); + widget.set({ + message: "foo", + proposals: ["foo", "bar", "baz"], + text: "foo" + }); +} + +function test_Slider() { + var widget: tabris.Slider = tabris.create("Slider", {}); + widget.set("foo", 23); + widget.set({ + minimum: 0, + maximum: 100, + selection: 23 + }); +} + +function test_Switch() { + var widget: tabris.Switch = tabris.create("Switch", {}); + widget.set("foo", 23); + widget.set({ + selection: true + }); +} + +function test_TextInput() { + var widget: tabris.TextInput = tabris.create("TextInput", {}); + widget.set("foo", 23); + widget.set({ + alignment: "center", + autoCapitalize: true, + autoCorrect: false, + editable: true, + text: "foo", + message: "bar", + type: "search", + keyboard: "ascii" + }); +} + +function test_Tab() { + var widget: tabris.Tab = tabris.create("Tab", {}); + widget.set("foo", 23); + widget.set({ + badge: "foo", + title: "bar", + image: {src: "http://example.org"} + }); +} + +function test_TabFolder() { + var widget: tabris.TabFolder = tabris.create("TabFolder", {}); + widget.set("foo", 23); + widget.set({ + paging: true, + tabBarLocation: "auto", + selection: tab1 + }); + var tab1: tabris.Tab, tab2: tabris.Tab; + var same: tabris.TabFolder = widget.append(tab1, tab2); +} + +function test_TextView() { + var widget: tabris.TextView = tabris.create("TextView", {}); + widget.set("foo", 23); + widget.set({ + alignment: "center", + markupEnabled: true, + maxLines: 23, + text: "foo" + }); +} + +function test_ToggleButton() { + var widget: tabris.ToggleButton = tabris.create("ToggleButton", {}); + widget.set("foo", 23); + widget.set({ + alignment: "center", + image: {src: "http://example.org/"}, + selection: true, + text: "foo" + }); +} + +function test_Video() { + var widget: tabris.Video = tabris.create("Video", {}); + widget.set("foo", 23); + widget.set({ + url: "http://example.org" + }); +} + +function test_WebView() { + var widget: tabris.WebView = tabris.create("WebView", {}); + widget.set("foo", 23); + widget.set({ + html: "", + url: "http://example.org" + }); +} + +function test_WidgetCollection() { + var collection: tabris.WidgetCollection = page.find(); + var length: number = collection.length; + var grandParents: tabris.WidgetCollection = collection.parent().parent(); + var grandChildren: tabris.WidgetCollection = collection.children().children(); + var found: tabris.WidgetCollection = collection.find().find(".class"); + collection.appendTo(page); + collection.dispose(); +} + +function test_tabris_app() { + tabris.app.installPatch("url", (error: Error, patch: Object) => {}); + tabris.app.reload(); +} + +function test_tabris_device() { + var lang: string = tabris.device.get("language"); + var model: string = tabris.device.get("model"); + var orient: string = tabris.device.get("orientation"); + var platform: string = tabris.device.get("platform"); + var factor: number = tabris.device.get("scaleFactor"); + var height: number = tabris.device.get("screenHeight"); + var width: number = tabris.device.get("screenWidth"); + var version: string = tabris.device.get("version"); + var same: tabris.Device = tabris.device.on("change:orientation", () => {}).off("change:orientation"); +} + +function test_tabris_ui() { + var page: tabris.Page = tabris.ui.get("activePage"); + var bg: string = tabris.ui.get("background"); + var tc: string = tabris.ui.get("textColor"); + var visible: boolean = tabris.ui.get("toolbarVisible"); + var same: tabris.UI = tabris.ui.on("change:activePage", () => {}).off("change:activePage"); +} diff --git a/tabris/tabris.d.ts b/tabris/tabris.d.ts new file mode 100644 index 000000000..9a0b4defe --- /dev/null +++ b/tabris/tabris.d.ts @@ -0,0 +1,1446 @@ +// Type definitions for Tabris.js v1.2 +// Project: http://tabrisjs.com +// Definitions by: Tabris.js team +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module tabris { + + // Types + + interface Bounds { + + /** + * the horizontal offset from the parent's left edge in dip + */ + left: number; + + /** + * the vertical offset from the parent's top edge in dip + */ + top: number; + + /** + * the width of the widget in dip + */ + width: number; + + /** + * the height of the widget in dip + */ + height: number; + + } + + interface Transformation { + + /** + * Clock-wise rotation in radians. Defaults to `0`. + */ + rotation: number; + + /** + * Horizontal scale factor. Defaults to `1`. + */ + scaleX: number; + + /* + * Vertical scale factor. Defaults to `1`. + */ + scaleY: number; + + /** + * Horizontal translation (shift) in dip. Defaults to `0`. + */ + translationX: number; + + /** + * Vertical translation (shift) in dip. Defaults to `0`. + */ + translationY: number; + + } + + // TODO A plain string can be used as a shorthand, e.g. `"image.jpg"` equals `{src: "image.jpg"}`. + interface Image { + + /** + * Image path or URL. + */ + src?: string; + + /** + * Image width, extracted from the image file when missing. + */ + width?: number; + + /** + * Image height, extracted from the image file when missing. + */ + height?: number; + + /** + * Image scale factor - the image will be scaled down by this factor. + * Ignored when width or height are set. + */ + scale?: number; + + } + + interface CanvasContext { + // TODO + } + + // Events + + /** + * Event handling API supported by widgets and various other objects. + */ + interface EventSupport { + + /** + * Adds the *listener* to the list of functions to be notified when *event* is fired. + * In the listener function, `this` will point to the object itself. Supports chaining. + * + * @param event the name of the event to listen on + * @param listener the listener function + */ + on (event: string, listener: (target: T, ...args: any[]) => any): T; + + /** + * Same as `on`, but removes the listener after it has been invoked by an event. + * Supports chaining. + * + * @param event the name of the event to listen on + * @param listener the listener function + */ + once (event: string, listener: (target: T, ...args: any[]) => any): T; + + /** + * Removes all listeners for all events from this widget. Supports chaining. + */ + off (): T; + + /** + * Removes all listeners for *event* from this widget. Supports chaining. + * + * @param event the event name to remove listeners for + */ + off (event: string): T; + + /** + * Removes all occurrences of *listener* that are bound to *event* from this widget. + * Supports chaining. + * + * @param event the event to remove the listener from + * @param listener the listener function to remove + */ + off (event: string, listener: (target: T, ...args: any[]) => any): T; + + /** + * Triggers an event on this object. Supports chaining. + * + * @param event the name of the event to trigger + * @param args the arguments to pass to the listener functions + */ + trigger (event: string, ...args: any[]): T; + + } + + interface AnimationOptions { + + /** + * The time until the animation starts in ms, defaults to `0`. + */ + delay?: number; + + /** + * The duration in ms. + */ + duration: number; + + /** + * One of `linear`, `ease-in`, `ease-out`, `ease-in-out`. + */ + easing: string; + + /** + * The number of times to repeat the animation, defaults to `0`. + */ + repeat: number; + + /** + * `true` to alternate the direction of the animation on every repeat. + */ + reverse: boolean; + + /** + * No effect, but will be given in animation events. + */ + name: string; + + } + + // Widget + + function create (type: string, properties: WidgetProperties): Widget; + + /** + * API supported by all widgets. + */ + interface Widget extends EventSupport { + + // Property Support + + /** + * Gets the current value of the given *property*. + * + * @param property + */ + get (property: string): any; + + /** + * Sets the given property. Supports chaining. + * + * @param property the name of the property to set + * @param value the value to set the property to + * @param options passed to the change event resulting from this method call + */ + set (property: string, value: any, options?: Object): T; + + /** + * Sets all key-value pairs in the properties object as widget properties. Supports chaining. + * + * @param properties the properties to set + * @param options passed to the change event resulting from this method call + */ + set (properties: WidgetProperties, options?: Object): T; + + /** + * Starts an animation that transforms the given properties from their current values to the given ones. + * Supported properties are *transform* and *opacity*. + * + * @param properties The properties and target values to animate. + * @param options Configures the animation itself. + */ + animate (properties: WidgetProperties, options: AnimationOptions): void; + + /** + * Appends this widget to the given parent. + * The parent widget must support children (extending *Composite*). + * + * @param parent the parent widget to append this one to + */ + appendTo (parent: Composite): T; + + /** + * Applies the given properties to all descendants that match the associated selector(s). + * + * @param properties an object in the format + * `{selector: {property: value, property: value, ... }, selector: ...}` + */ + apply (properties: Object): T; + + /** + * Returns a (possibly empty) collection of all children of this widget. + */ + children (): WidgetCollection; + + /** + * Returns a (possibly empty) collection of all children of this widget that match the selector. + * + * @param selector a selector string to filter children + */ + children (selector: string): WidgetCollection; + + /** + * Removes this widget from its parent and destroys it. Also disposes of all its children. + * Triggers a `remove` event on the parent and a `dispose` event on itself. + * The widget can no longer be used. + */ + dispose (): void; + + /** + * Returns a (possibly empty) collection of all descendants of this widget. + */ + find (): WidgetCollection + + /** + * Returns a (possibly empty) collection of all descendants of this widget that match the selector. + * @param selector + */ + find (selector: string): WidgetCollection + + /** + * Returns `true` if the widget has been disposed, otherwise `false`. + */ + isDisposed (): boolean + + /** + * Returns the parent of this widget. + */ + parent (): T; + + /** + * An application-wide unique identifier automatically assigned to all widgets on creation. + * Do not change it. + */ + cid: string; + + /** + * Direct access to the value of the property of the same name. + * May be used instead of `widget.get("id");`. + * Do not use this field to change the value, instead use `widget.set("id", id);`. + */ + id: string; + + /** + * The exact string that was used to create this widget using the `tabris.create` method. + */ + type: string; + + } + + interface WidgetProperties { + + /** + * The background color of the widget. + */ + background?: string; + + /** + * An image to be displayed on the widget's background. + * If the image is smaller than the widget, it will be tiled. + */ + backgroundImage?: Image; + + /** + * The vertical position of the widget's baseline relative to a sibling widget. + */ + baseline?: any; + + /** + * The position of the widget's bottom edge relative to the parent or a sibling widget. + */ + bottom?: any; + + /** + * The actual location and size of the widget, relative to its parent. This property is read-only. + */ + bounds?: Bounds; + + /** + * The horizontal position of the widget's center relative to the parent's center. + */ + centerX?: number; + + /** + * The vertical position of the widget's center relative to the parent's center. + */ + centerY?: number; + + /** + * Whether the widget can be operated. + */ + enabled?: boolean; + + /** + * The font used for the widget. + */ + font?: string; + + /** + * The height of the widget. + */ + height?: number; + + /** + * Whether the entire widget should be highlighted while touched. + */ + highlightOnTouch?: boolean; + + /** + * A string to identify the widget by using selectors. Id's are optional. + * It is strongly recommended that they are unique within a page. + */ + id?: string; + + /** + * Shorthand for all layout properties. See [Layout](../layout.md). + */ + layoutData?: Object; + + /** + * The position of the widget's left edge relative to the parent or a sibling widget. + */ + left?: any; + + /** + * Opacity of the entire widget. Can be used for fade animations. + */ + opacity?: number; + + /** + * The position of the widget's right edge relative to the parent or a sibling widget. + */ + right?: any; + + /** + * Text color of the widget. + */ + textColor?: string; + + /** + * The position of the widget's top edge relative to the parent or a sibling widget. + */ + top?: any; + + /** + * Modifications to the widget's shape, size, or position. Can be used for animations. + * **Note:** In Android, the *transform* property does not affect the *bounds* property, + * while it does so in iOS. + */ + transform?: Transformation; + + /** + * Whether the widget is visible. + */ + visible?: boolean; + + /** + * The width of the widget. + */ + width?: number; + + } + + // Action + + function create (type: "Action", properties: ActionProperties): Action; + + /** + * An executable item that is integrated in the application's navigation menu. + * Add a listener on *select* to implement the action. + */ + interface Action extends Widget { + + set (property: string, value: any, options?: Object): Action; + set (properties: ActionProperties, options?: Object): Action; + + } + + interface ActionProperties extends WidgetProperties { + + /** + * Icon image for the action. + */ + image?: Image; + + /** + * Actions with higher placement priority will be placed at a more significant position in the UI, + * e.g. low priority actions could go into a menu instead of being included in a toolbar. + * Any of `low`, `high`, `normal`. + */ + placementPriority?: string; + + /** + * The text to be displayed for the action. + */ + title?: string; + + } + + // Button + + function create (type: "Button", properties: ButtonProperties): Button; + + /** + * A push button. Can contain a text or an image. + */ + interface Button extends Widget