Updated underscore.d.ts to v1.6.0 and tsc 1.0.1

This commit is contained in:
jbaldwin
2014-05-17 16:43:01 -06:00
parent bb59fade92
commit 29ef6d0bb7
2 changed files with 80 additions and 31 deletions
+6 -6
View File
@@ -65,18 +65,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);
@@ -247,7 +247,7 @@ _.isUndefined((<any>window).missingVariable);
///////////////////////////////////////////////////////////////////////////////////////
var UncleMoe = {name: 'moe'};
var UncleMoe = { name: 'moe' };
_.constant(UncleMoe)();
typeof _.now() === "number";
+74 -25
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
@@ -567,11 +567,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.
@@ -917,7 +917,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.
@@ -1171,13 +1172,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
@@ -1185,6 +1179,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.
@@ -1447,22 +1448,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[]`.
@@ -1800,6 +1801,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
@@ -2056,6 +2063,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
@@ -2162,6 +2181,12 @@ interface Underscore<T> {
**/
identity(): any;
/**
* Wrapped type `any`.
* @see _.constant
**/
constant(): () => T;
/**
* Wrapped type `number`.
* @see _.times
@@ -2236,22 +2261,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[]`.
@@ -2270,7 +2295,7 @@ interface _Chain<T> {
* @see _.map
**/
map<TArray>(iterator: _.ObjectIterator<T, TArray[]>, context?: any): _ChainOfArrays<TArray>;
/**
* Wrapped type `any[]`.
* @see _.map
@@ -2601,6 +2626,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
@@ -2855,6 +2886,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
@@ -2961,6 +3004,12 @@ interface _Chain<T> {
**/
identity(): _Chain<T>;
/**
* Wrapped type `any`.
* @see _.constant
**/
constant(): _Chain<T>;
/**
* Wrapped type `number`.
* @see _.times