Skip to content

Commit 1829a18

Browse files
committed
use type instead of var
1 parent 1e788b2 commit 1829a18

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

Diff for: object-path/object-path.d.ts

+20-20
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ declare var objectPath: ObjectPathGlobal.IObjectPathStatic;
77

88
declare module ObjectPathGlobal {
99

10-
var Path: Array<number|string>|number|string;
11-
var multiArray: Array<typeof Path>;
10+
type IPath = Array<number|string>|number|string;
11+
type IMultiArray = Array<IPath>;
1212

1313
interface IObjectPathStatic {
1414
/**
@@ -24,7 +24,7 @@ declare module ObjectPathGlobal {
2424
* @param {string[]|string} path
2525
* @return object
2626
*/
27-
del<T extends {}>(object: T, path: typeof Path): T;
27+
del<T extends {}>(object: T, path: IPath): T;
2828
/**
2929
* @see objectPath.del
3030
*/
@@ -41,7 +41,7 @@ declare module ObjectPathGlobal {
4141
* @param {string[]|string} path
4242
* @return object
4343
*/
44-
has<T extends {}>(object: T, path: typeof Path): boolean;
44+
has<T extends {}>(object: T, path: IPath): boolean;
4545
/**
4646
* @see objectPath.has
4747
*/
@@ -58,7 +58,7 @@ declare module ObjectPathGlobal {
5858
* @param {string|string[]|number|number[]} path
5959
* @param {*} [defaultValue=undefined]
6060
*/
61-
get<T extends {}, TResult>(object: T, path: typeof Path, defaultValue?: TResult): TResult;
61+
get<T extends {}, TResult>(object: T, path: IPath, defaultValue?: TResult): TResult;
6262
/**
6363
* @see objectPath.get
6464
*/
@@ -77,7 +77,7 @@ declare module ObjectPathGlobal {
7777
* @param {boolean} [doNotReplace=false]
7878
* @return Any existing value on the path if any
7979
*/
80-
set<T extends {}, TExisting>(object: T, path: typeof Path, value: any, doNotReplace?:boolean): TExisting;
80+
set<T extends {}, TExisting>(object: T, path: IPath, value: any, doNotReplace?:boolean): TExisting;
8181
/**
8282
* @see objectPath.set
8383
*/
@@ -92,7 +92,7 @@ declare module ObjectPathGlobal {
9292
* Create (if path isn't an array) and push the value to it. Can push unlimited number of values
9393
* @param {object} object
9494
*/
95-
push<T extends {}>(object: T, path: typeof Path, ...args:any[]):void;
95+
push<T extends {}>(object: T, path: IPath, ...args:any[]):void;
9696
/**
9797
* @see objectPath.push
9898
*/
@@ -106,7 +106,7 @@ declare module ObjectPathGlobal {
106106
* @param {*} defaultValue
107107
* @return {*}
108108
*/
109-
coalesce<T extends {}, TResult>(object: T, paths: typeof multiArray, defaultValue?: TResult):TResult;
109+
coalesce<T extends {}, TResult>(object: T, paths: IMultiArray, defaultValue?: TResult):TResult;
110110

111111
/*======== Empty =========*/
112112
/**
@@ -115,7 +115,7 @@ declare module ObjectPathGlobal {
115115
* @param {object} object
116116
* @param {string|string[]|number[]} path
117117
*/
118-
empty<T extends {}, TResult>(object: T, path: typeof Path):TResult;
118+
empty<T extends {}, TResult>(object: T, path: IPath):TResult;
119119
/**
120120
* @see objectPath.empty
121121
*/
@@ -131,7 +131,7 @@ declare module ObjectPathGlobal {
131131
* @param {object} object
132132
* @param {string|string[]|number|number[]} path
133133
*/
134-
ensureExists<T extends {}, TExisting>(object: T, path: typeof Path, value: any):TExisting;
134+
ensureExists<T extends {}, TExisting>(object: T, path: IPath, value: any):TExisting;
135135
/**
136136
* @see objectPath.ensureExists
137137
*/
@@ -149,7 +149,7 @@ declare module ObjectPathGlobal {
149149
* @param {*} value
150150
* @param {number} [at=0]
151151
*/
152-
insert<T extends {}>(object: T, path: typeof Path, value: any, at?: number):void;
152+
insert<T extends {}>(object: T, path: IPath, value: any, at?: number):void;
153153
}
154154

155155
interface IObjectPathBound<T extends {}> {
@@ -158,7 +158,7 @@ declare module ObjectPathGlobal {
158158
/**
159159
* @see objectPath.ensureExists
160160
*/
161-
del(path: typeof Path): T;
161+
del(path: IPath): T;
162162
/**
163163
* @see objectPath.del
164164
*/
@@ -168,7 +168,7 @@ declare module ObjectPathGlobal {
168168
/**
169169
* @see objectPath.ensureExists
170170
*/
171-
has(path: typeof Path): boolean;
171+
has(path: IPath): boolean;
172172
/**
173173
* @see objectPath.has
174174
*/
@@ -178,7 +178,7 @@ declare module ObjectPathGlobal {
178178
/**
179179
* @see objectPath.ensureExists
180180
*/
181-
get<TResult>(path: typeof Path, defaultValue?: TResult): TResult;
181+
get<TResult>(path: IPath, defaultValue?: TResult): TResult;
182182
/**
183183
* @see objectPath.get
184184
*/
@@ -188,7 +188,7 @@ declare module ObjectPathGlobal {
188188
/**
189189
* @see objectPath.ensureExists
190190
*/
191-
set<TExisting>(path: typeof Path, value: any, doNotReplace?:boolean): TExisting;
191+
set<TExisting>(path: IPath, value: any, doNotReplace?:boolean): TExisting;
192192
/**
193193
* @see objectPath.set
194194
*/
@@ -198,7 +198,7 @@ declare module ObjectPathGlobal {
198198
/**
199199
* @see objectPath.ensureExists
200200
*/
201-
push(path: typeof Path, ...args:any[]):void;
201+
push(path: IPath, ...args:any[]):void;
202202
/**
203203
* @see objectPath.push
204204
*/
@@ -208,13 +208,13 @@ declare module ObjectPathGlobal {
208208
/**
209209
* @see objectPath.ensureExists
210210
*/
211-
coalesce<TResult>(paths: typeof multiArray, defaultValue?: TResult):TResult;
211+
coalesce<TResult>(paths: IMultiArray, defaultValue?: TResult):TResult;
212212

213213
/*======== Empty =========*/
214214
/**
215215
* @see objectPath.ensureExists
216216
*/
217-
empty(path: typeof Path):T;
217+
empty(path: IPath):T;
218218
/**
219219
* @see objectPath.empty
220220
*/
@@ -224,7 +224,7 @@ declare module ObjectPathGlobal {
224224
/**
225225
* @see objectPath.ensureExists
226226
*/
227-
ensureExists<TExisting>(path: typeof Path, value: any):TExisting;
227+
ensureExists<TExisting>(path: IPath, value: any):TExisting;
228228
/**
229229
* @see objectPath.ensureExists
230230
*/
@@ -234,7 +234,7 @@ declare module ObjectPathGlobal {
234234
/**
235235
* @see objectPath.insert
236236
*/
237-
insert(path: typeof Path, value: any, at?: number):void;
237+
insert(path: IPath, value: any, at?: number):void;
238238
}
239239
}
240240

0 commit comments

Comments
 (0)