Merge pull request #2208 from jbaldwin/master

Updated underscore.d.ts to v1.6.0 and tsc 1.0.1
This commit is contained in:
Basarat Ali Syed 2014-05-20 21:26:17 +10:00
commit 36febf66ea
2 changed files with 80 additions and 31 deletions

View File

@ -69,18 +69,18 @@ _.countBy([1, 2, 3, 4, 5], (num) => (num % 2 == 0) ? 'even' : 'odd');
_.shuffle([1, 2, 3, 4, 5, 6]);
(function(a, b, c, d){ return _.toArray(arguments).slice(1); })(1, 2, 3, 4);
(function (a, b, c, d) { return _.toArray(arguments).slice(1); })(1, 2, 3, 4);
_.size({ one: 1, two: 2, three: 3 });
_.partition<number>([0, 1, 2, 3, 4, 5], (num)=>{return num % 2 ==0});
_.partition<number>([0, 1, 2, 3, 4, 5], (num) => {return num % 2 == 0 });
interface Family {
name: string;
relation : string;
relation: string;
}
var isUncleMoe = _.matches<Family, boolean>({name : 'moe', relation : 'uncle'});
_.filter([{name: 'larry', relation : 'father'}, {name : 'moe', relation : 'uncle'}], isUncleMoe);
var isUncleMoe = _.matches<Family, boolean>({ name: 'moe', relation: 'uncle' });
_.filter([{ name: 'larry', relation: 'father' }, { name: 'moe', relation: 'uncle' }], isUncleMoe);
@ -251,7 +251,7 @@ _.isUndefined((<any>window).missingVariable);
///////////////////////////////////////////////////////////////////////////////////////
var UncleMoe = {name: 'moe'};
var UncleMoe = { name: 'moe' };
_.constant(UncleMoe)();
typeof _.now() === "number";

View File

@ -92,7 +92,7 @@ interface UnderscoreStatic {
each<T>(
list: _.List<T>,
iterator: _.ListIterator<T, void>,
context?: any): void;
context?: any): _.List<T>;
/**
* @see _.each
@ -103,23 +103,23 @@ interface UnderscoreStatic {
each<T>(
object: _.Dictionary<T>,
iterator: _.ObjectIterator<T, void>,
context?: any): void;
context?: any): _.Dictionary<T>;
/**
* @see _.each
**/
forEach<T>(
list: _.List<T>,
iterator: _.ListIterator<T, void >,
context?: any): void;
iterator: _.ListIterator<T, void>,
context?: any): _.List<T>;
/**
* @see _.each
**/
forEach<T>(
object: _.Dictionary<T>,
iterator: _.ObjectIterator<T, void >,
context?: any): void;
iterator: _.ObjectIterator<T, void>,
context?: any): _.Dictionary<T>;
/**
* Produces a new array of values by mapping each value in list through a transformation function
@ -629,11 +629,11 @@ interface UnderscoreStatic {
* @return Number of values in `list`.
**/
size<T>(list: _.Collection<T>): number;
/**
* Split array into two arrays:
* one whose elements all satisfy predicate and one whose elements all do not satisfy predicate.
* @param array Array to split in two
* @param array Array to split in two.
* @param iterator Filter iterator function for each element in `array`.
* @param context `this` object in `iterator`, optional.
* @return Array where Array[0] are the elements in `array` that satisfies the predicate, and Array[1] the elements that did not.
@ -979,7 +979,8 @@ interface UnderscoreStatic {
/**
* Partially apply a function by filling in any number of its arguments, without changing its dynamic this value.
* A close cousin of bind.
* A close cousin of bind. You may pass _ in your list of arguments to specify an argument that should not be
* pre-filled, but left open to supply at call-time.
* @param fn Function to partially fill in arguments.
* @param arguments The partial arguments.
* @return `fn` with partially filled in arguments.
@ -1233,13 +1234,6 @@ interface UnderscoreStatic {
**/
has(object: any, key: string): boolean;
/**
* Returns a function that will itself return the key property of any passed-in object
* @param key Property of the object
* @return Function which accept an object an returns the value of key in that object
**/
property(key: string): (object: Object)=> any;
/**
* Returns a predicate function that will tell you if a passed in object contains all of the key/value properties present in attrs.
* @param attrs Object with key values pair
@ -1247,6 +1241,13 @@ interface UnderscoreStatic {
**/
matches<T, TResult>(attrs: T): _.ListIterator<T, TResult>;
/**
* Returns a function that will itself return the key property of any passed-in object.
* @param key Property of the object.
* @return Function which accept an object an returns the value of key in that object.
**/
property(key: string): (object: Object) => any;
/**
* Performs an optimized deep comparison between the two objects,
* to determine if they should be considered equal.
@ -1509,22 +1510,22 @@ interface Underscore<T> {
* Wrapped type `any[]`.
* @see _.each
**/
each(iterator: _.ListIterator<T, void>, context?: any): void;
each(iterator: _.ListIterator<T, void>, context?: any): T[];
/**
* @see _.each
**/
each(iterator: _.ObjectIterator<T, void>, context?: any): void;
each(iterator: _.ObjectIterator<T, void>, context?: any): T[];
/**
* @see _.each
**/
forEach(iterator: _.ListIterator<T, void>, context?: any): void;
forEach(iterator: _.ListIterator<T, void>, context?: any): T[];
/**
* @see _.each
**/
forEach(iterator: _.ObjectIterator<T, void>, context?: any): void;
forEach(iterator: _.ObjectIterator<T, void>, context?: any): T[];
/**
* Wrapped type `any[]`.
@ -1862,6 +1863,12 @@ interface Underscore<T> {
**/
without(...values: T[]): T[];
/**
* Wrapped type `any[]`.
* @see _.partition
**/
partition(iterator: _.ListIterator<T, boolean>, context?: any): T[][];
/**
* Wrapped type `any[][]`.
* @see _.union
@ -2118,6 +2125,18 @@ interface Underscore<T> {
**/
has(key: string): boolean;
/**
* Wrapped type `any[]`.
* @see _.matches
**/
matches<TResult>(): _.ListIterator<T, TResult>;
/**
* Wrapped type `string`.
* @see _.property
**/
property(): (object: Object) => any;
/**
* Wrapped type `object`.
* @see _.isEqual
@ -2224,6 +2243,12 @@ interface Underscore<T> {
**/
identity(): any;
/**
* Wrapped type `any`.
* @see _.constant
**/
constant(): () => T;
/**
* Wrapped type `number`.
* @see _.times
@ -2298,22 +2323,22 @@ interface _Chain<T> {
* Wrapped type `any[]`.
* @see _.each
**/
each(iterator: _.ListIterator<T, void >, context?: any): _Chain<T>;
each(iterator: _.ListIterator<T, void>, context?: any): _Chain<T>;
/**
* @see _.each
**/
each(iterator: _.ObjectIterator<T, void >, context?: any): _Chain<T>;
each(iterator: _.ObjectIterator<T, void>, context?: any): _Chain<T>;
/**
* @see _.each
**/
forEach(iterator: _.ListIterator<T, void >, context?: any): _Chain<T>;
forEach(iterator: _.ListIterator<T, void>, context?: any): _Chain<T>;
/**
* @see _.each
**/
forEach(iterator: _.ObjectIterator<T, void >, context?: any): _Chain<T>;
forEach(iterator: _.ObjectIterator<T, void>, context?: any): _Chain<T>;
/**
* Wrapped type `any[]`.
@ -2332,7 +2357,7 @@ interface _Chain<T> {
* @see _.map
**/
map<TArray>(iterator: _.ObjectIterator<T, TArray[]>, context?: any): _ChainOfArrays<TArray>;
/**
* Wrapped type `any[]`.
* @see _.map
@ -2663,6 +2688,12 @@ interface _Chain<T> {
**/
without(...values: T[]): _Chain<T>;
/**
* Wrapped type `any[]`.
* @see _.partition
**/
partition(iterator: _.ListIterator<T, boolean>, context?: any): _Chain<T[][]>;
/**
* Wrapped type `any[][]`.
* @see _.union
@ -2917,6 +2948,18 @@ interface _Chain<T> {
**/
has(key: string): _Chain<T>;
/**
* Wrapped type `any[]`.
* @see _.matches
**/
matches<TResult>(): _Chain<T>;
/**
* Wrapped type `string`.
* @see _.property
**/
property(): _Chain<T>;
/**
* Wrapped type `object`.
* @see _.isEqual
@ -3023,6 +3066,12 @@ interface _Chain<T> {
**/
identity(): _Chain<T>;
/**
* Wrapped type `any`.
* @see _.constant
**/
constant(): _Chain<T>;
/**
* Wrapped type `number`.
* @see _.times