use type instead of var

This commit is contained in:
Paulo Cesar
2015-04-18 02:16:32 -03:00
parent 1e788b224b
commit 1829a18eda
+20 -20
View File
@@ -7,8 +7,8 @@ declare var objectPath: ObjectPathGlobal.IObjectPathStatic;
declare module ObjectPathGlobal {
var Path: Array<number|string>|number|string;
var multiArray: Array<typeof Path>;
type IPath = Array<number|string>|number|string;
type IMultiArray = Array<IPath>;
interface IObjectPathStatic {
/**
@@ -24,7 +24,7 @@ declare module ObjectPathGlobal {
* @param {string[]|string} path
* @return object
*/
del<T extends {}>(object: T, path: typeof Path): T;
del<T extends {}>(object: T, path: IPath): T;
/**
* @see objectPath.del
*/
@@ -41,7 +41,7 @@ declare module ObjectPathGlobal {
* @param {string[]|string} path
* @return object
*/
has<T extends {}>(object: T, path: typeof Path): boolean;
has<T extends {}>(object: T, path: IPath): boolean;
/**
* @see objectPath.has
*/
@@ -58,7 +58,7 @@ declare module ObjectPathGlobal {
* @param {string|string[]|number|number[]} path
* @param {*} [defaultValue=undefined]
*/
get<T extends {}, TResult>(object: T, path: typeof Path, defaultValue?: TResult): TResult;
get<T extends {}, TResult>(object: T, path: IPath, defaultValue?: TResult): TResult;
/**
* @see objectPath.get
*/
@@ -77,7 +77,7 @@ declare module ObjectPathGlobal {
* @param {boolean} [doNotReplace=false]
* @return Any existing value on the path if any
*/
set<T extends {}, TExisting>(object: T, path: typeof Path, value: any, doNotReplace?:boolean): TExisting;
set<T extends {}, TExisting>(object: T, path: IPath, value: any, doNotReplace?:boolean): TExisting;
/**
* @see objectPath.set
*/
@@ -92,7 +92,7 @@ declare module ObjectPathGlobal {
* Create (if path isn't an array) and push the value to it. Can push unlimited number of values
* @param {object} object
*/
push<T extends {}>(object: T, path: typeof Path, ...args:any[]):void;
push<T extends {}>(object: T, path: IPath, ...args:any[]):void;
/**
* @see objectPath.push
*/
@@ -106,7 +106,7 @@ declare module ObjectPathGlobal {
* @param {*} defaultValue
* @return {*}
*/
coalesce<T extends {}, TResult>(object: T, paths: typeof multiArray, defaultValue?: TResult):TResult;
coalesce<T extends {}, TResult>(object: T, paths: IMultiArray, defaultValue?: TResult):TResult;
/*======== Empty =========*/
/**
@@ -115,7 +115,7 @@ declare module ObjectPathGlobal {
* @param {object} object
* @param {string|string[]|number[]} path
*/
empty<T extends {}, TResult>(object: T, path: typeof Path):TResult;
empty<T extends {}, TResult>(object: T, path: IPath):TResult;
/**
* @see objectPath.empty
*/
@@ -131,7 +131,7 @@ declare module ObjectPathGlobal {
* @param {object} object
* @param {string|string[]|number|number[]} path
*/
ensureExists<T extends {}, TExisting>(object: T, path: typeof Path, value: any):TExisting;
ensureExists<T extends {}, TExisting>(object: T, path: IPath, value: any):TExisting;
/**
* @see objectPath.ensureExists
*/
@@ -149,7 +149,7 @@ declare module ObjectPathGlobal {
* @param {*} value
* @param {number} [at=0]
*/
insert<T extends {}>(object: T, path: typeof Path, value: any, at?: number):void;
insert<T extends {}>(object: T, path: IPath, value: any, at?: number):void;
}
interface IObjectPathBound<T extends {}> {
@@ -158,7 +158,7 @@ declare module ObjectPathGlobal {
/**
* @see objectPath.ensureExists
*/
del(path: typeof Path): T;
del(path: IPath): T;
/**
* @see objectPath.del
*/
@@ -168,7 +168,7 @@ declare module ObjectPathGlobal {
/**
* @see objectPath.ensureExists
*/
has(path: typeof Path): boolean;
has(path: IPath): boolean;
/**
* @see objectPath.has
*/
@@ -178,7 +178,7 @@ declare module ObjectPathGlobal {
/**
* @see objectPath.ensureExists
*/
get<TResult>(path: typeof Path, defaultValue?: TResult): TResult;
get<TResult>(path: IPath, defaultValue?: TResult): TResult;
/**
* @see objectPath.get
*/
@@ -188,7 +188,7 @@ declare module ObjectPathGlobal {
/**
* @see objectPath.ensureExists
*/
set<TExisting>(path: typeof Path, value: any, doNotReplace?:boolean): TExisting;
set<TExisting>(path: IPath, value: any, doNotReplace?:boolean): TExisting;
/**
* @see objectPath.set
*/
@@ -198,7 +198,7 @@ declare module ObjectPathGlobal {
/**
* @see objectPath.ensureExists
*/
push(path: typeof Path, ...args:any[]):void;
push(path: IPath, ...args:any[]):void;
/**
* @see objectPath.push
*/
@@ -208,13 +208,13 @@ declare module ObjectPathGlobal {
/**
* @see objectPath.ensureExists
*/
coalesce<TResult>(paths: typeof multiArray, defaultValue?: TResult):TResult;
coalesce<TResult>(paths: IMultiArray, defaultValue?: TResult):TResult;
/*======== Empty =========*/
/**
* @see objectPath.ensureExists
*/
empty(path: typeof Path):T;
empty(path: IPath):T;
/**
* @see objectPath.empty
*/
@@ -224,7 +224,7 @@ declare module ObjectPathGlobal {
/**
* @see objectPath.ensureExists
*/
ensureExists<TExisting>(path: typeof Path, value: any):TExisting;
ensureExists<TExisting>(path: IPath, value: any):TExisting;
/**
* @see objectPath.ensureExists
*/
@@ -234,7 +234,7 @@ declare module ObjectPathGlobal {
/**
* @see objectPath.insert
*/
insert(path: typeof Path, value: any, at?: number):void;
insert(path: IPath, value: any, at?: number):void;
}
}