@@ -16,31 +16,32 @@ export default class Collection<T> {
16
16
count ( ) : number ;
17
17
each ( callback : ( item : T ) => void ) : Collection < T > ;
18
18
filter ( callback : ( item : T ) => boolean ) : Collection < T > ;
19
- find ( item : any ) : number ;
19
+ find ( item : T ) : number ;
20
20
first ( callback ?: ( ( item : T ) => boolean ) | null ) : T ;
21
21
flatten ( deep ?: boolean ) : Collection < T > ;
22
22
get ( index : number ) : T ;
23
23
has ( item : T ) : boolean ;
24
24
join ( separator ?: string ) : string ;
25
25
keys ( ) : Collection < T > ;
26
26
last ( callback ?: ( ( item : T ) => boolean ) | null ) : T ;
27
- map ( callback : ( item : T ) => any ) : Collection < T > ;
27
+ map < R > ( callback : ( item : T ) => R ) : Collection < T > ;
28
28
pluck ( property : string ) : Collection < T > ;
29
29
push ( item : T ) : Collection < T > ;
30
- reduce ( callback : ( previous : T , current : T ) => any , initial : any ) : any ;
30
+ reduce < R > ( callback : ( previous : R , current : T ) => R , initial : R ) : R ;
31
31
reject ( callback : ( item : T ) => boolean ) : Collection < T > ;
32
- remove ( item : any ) : boolean ;
32
+ remove ( item : T ) : boolean ;
33
33
reverse ( ) : Collection < T > ;
34
34
skip ( count : number ) : Collection < T > ;
35
35
slice ( start : number , end ?: number ) : Collection < T > ;
36
36
sort ( compare ?: ( ) => boolean ) : Collection < T > ;
37
37
sortBy ( property : string , order ?: string ) : Collection < T > ;
38
38
stringify ( ) : string ;
39
- sum ( property ?: string | null ) : any ;
39
+ sum ( property : T extends object ? keyof T : never ) : number
40
40
take ( count : number ) : Collection < T > ;
41
- macro ( name : string , callback : ( ...args : any ) => any ) : any ;
41
+ static macro ( name : string , callback : ( coll : Collection < unknown > , ...args : unknown [ ] ) => unknown ) : void ;
42
42
unique ( callback ?: string | null | ( ( item : T ) => any ) ) : Collection < T > ;
43
43
values ( ) : Collection < T > ;
44
- where ( callback : ( ( item : T ) => boolean ) | string , value ?: any ) : Collection < T > ;
44
+ where < K extends keyof T > ( key : K , value : T [ K ] ) : Collection < T >
45
+ where ( callback : ( item : T ) => boolean ) : Collection < T >
45
46
zip ( array : T [ ] | Collection < T > ) : Collection < T > ;
46
47
}
0 commit comments