Skip to content

Commit 6f5747e

Browse files
committed
fixed types
1 parent c6e1ecb commit 6f5747e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+174
-181
lines changed

dev/IArray.ts

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
interface Array<T> {
2-
Order: Array<Linq4JS.OrderEntry>;
2+
Order: Linq4JS.OrderEntry[];
33
GroupValue: any;
44

55
/**
66
* Creates a copy of the array
77
*/
8-
Clone(): Array<T>;
8+
Clone(): T[];
99

1010
/**
1111
* Gets the index of the first item found by a filter
@@ -29,75 +29,75 @@
2929
* Executes a method for each item in the array
3030
* @param action A function (or function-string) that gets executed for each element. If it returns false the loop stops.
3131
*/
32-
ForEach(action: ((item: T, index?: number) => boolean | any) | string): Array<T>;
32+
ForEach(action: ((item: T, index?: number) => boolean | any) | string): T[];
3333

3434
/**
3535
* Updates an object in the array
3636
* @param object The object to update
3737
* @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array
3838
*/
39-
Update(object: T, primaryKeySelector?: ((item: T) => any) | string): Array<T>;
39+
Update(object: T, primaryKeySelector?: ((item: T) => any) | string): T[];
4040

4141
/**
4242
* Updates objects in the array
4343
* @param objects The array of objects to update
4444
* @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array
4545
*/
46-
UpdateRange(objects: Array<T>, primaryKeySelector?: ((item: T) => any) | string): Array<T>;
46+
UpdateRange(objects: T[], primaryKeySelector?: ((item: T) => any) | string): T[];
4747

4848
/**
4949
* Removes an object from the array
5050
* @param object The object to remove
5151
* @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array
5252
*/
53-
Remove(object: T, primaryKeySelector?: ((item: T) => any) | string): Array<T>;
53+
Remove(object: T, primaryKeySelector?: ((item: T) => any) | string): T[];
5454

5555
/**
5656
* Removes objects from the array
5757
* @param objects The array of objects to remove
5858
* @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array
5959
*/
60-
RemoveRange(objects: Array<T>, primaryKeySelector?: ((item: T) => any) | string): Array<T>;
60+
RemoveRange(objects: T[], primaryKeySelector?: ((item: T) => any) | string): T[];
6161

6262
/**
6363
* Adds an object to the array
6464
* @param object The object to add
6565
* @param generateId Auto-generate a property to identify object in later processes
6666
*/
67-
Add(object: T, generateId?: boolean): Array<T>;
67+
Add(object: T, generateId?: boolean): T[];
6868

6969
/**
7070
* Adds objects to the array
7171
* @param objects The array of objects to add
7272
*/
73-
AddRange(objects: Array<T>, generateId?: boolean): Array<T>;
73+
AddRange(objects: T[], generateId?: boolean): T[];
7474

7575
/**
7676
* Inserts an entry at a specific position
7777
* @param object The object to insert
7878
* @param index The position to insert
7979
*/
80-
Insert(object: T, index: number): Array<T>;
80+
Insert(object: T, index: number): T[];
8181

8282
/**
8383
* Searches for all items in array that match the given filter
8484
* @param filter A function (or function-string) that returns a boolean when matching element was found
8585
*/
86-
Where(filter: ((item: T, index?: number) => boolean) | string): Array<T>;
86+
Where(filter: ((item: T, index?: number) => boolean) | string): T[];
8787

8888
/**
8989
* Takes items in a specific range
9090
* @param start The start position
9191
* @param length The number of elements to take
9292
*/
93-
Range(start: number, length: number): Array<T>;
93+
Range(start: number, length: number): T[];
9494

9595
/**
9696
* Repeats an object in the array
9797
* @param object The object to repeat
9898
* @param count The count of repeats
9999
*/
100-
Repeat(object: T, count: number): Array<T>;
100+
Repeat(object: T, count: number): T[];
101101

102102
/**
103103
* Returns the length of the array
@@ -151,45 +151,45 @@
151151
* Limits the number of entries taken
152152
* @param count The count of elements taken
153153
*/
154-
Take(count: number): Array<T>;
154+
Take(count: number): T[];
155155

156156
/**
157157
* Takes entries as long as a condition is true
158158
* @param condition The condition-function (or function-string) that returns a boolean. All elements until a false gets created are taken
159159
* @param initial A initial-function (or function-string) that gets executed once at the start of the loop
160160
* @param after A function that gets executed after every element-iteration after the condition-function was evaluated
161161
*/
162-
TakeWhile(condition: ((item: T, storage?: any) => boolean) | string, initial?: ((storage: any) => void) | string, after?: ((item: T, storage: any) => void) | string): Array<T>;
162+
TakeWhile(condition: ((item: T, storage?: any) => boolean) | string, initial?: ((storage: any) => void) | string, after?: ((item: T, storage: any) => void) | string): T[];
163163

164164
/**
165165
* Skips entries
166166
* @param count The count of elements skipped
167167
*/
168-
Skip(count: number): Array<T>;
168+
Skip(count: number): T[];
169169

170170
/**
171171
* Orders array by property or value in ascending direction
172172
* @param valueSelector The selector-function (or function-string) that selects the property for sorting
173173
*/
174-
OrderBy(valueSelector: ((item: T) => any) | string): Array<T>;
174+
OrderBy(valueSelector: ((item: T) => any) | string): T[];
175175

176176
/**
177177
* Orders array by additional properties in ascending direction in combination with OrderBy/OrderByDescending
178178
* @param valueSelector The selector-function (or function-string) that selects the property for sorting
179179
*/
180-
ThenBy(valueSelector: ((item: T) => any) | string): Array<T>;
180+
ThenBy(valueSelector: ((item: T) => any) | string): T[];
181181

182182
/**
183183
* Orders array by property or value in descending direction
184184
* @param valueSelector The selector-function (or function-string) that selects the property for sorting
185185
*/
186-
OrderByDescending(valueSelector: ((item: T) => any) | string): Array<T>;
186+
OrderByDescending(valueSelector: ((item: T) => any) | string): T[];
187187

188188
/**
189189
* Orders array by additional properties in descending direction in combination with OrderBy/OrderByDescending
190190
* @param valueSelector The selector-function (or function-string) that selects the property for sorting
191191
*/
192-
ThenByDescending(valueSelector: ((item: T) => any) | string): Array<T>;
192+
ThenByDescending(valueSelector: ((item: T) => any) | string): T[];
193193

194194
/**
195195
* Returns the smallest element in array
@@ -207,20 +207,20 @@
207207
* Groups array by property
208208
* @param selector The selector-function (or function-string) that selects the property for grouping
209209
*/
210-
GroupBy(selector: ((item: T) => any) | string): Array<Array<T>>;
210+
GroupBy(selector: ((item: T) => any) | string): T[][];
211211

212212
/**
213213
* Moves an item from one index to another
214214
* @param oldIndex The current position of the item
215215
* @param newIndex The new position of the item
216216
*/
217-
Move(oldIndex: number, newIndex: number): Array<T>;
217+
Move(oldIndex: number, newIndex: number): T[];
218218

219219
/**
220220
* Makes all values unique
221221
* @param valueSelector A selector-function (or function-string) to select property for comparison and distinction
222222
*/
223-
Distinct(valueSelector?: ((item: T) => any) | string): Array<T>;
223+
Distinct(valueSelector?: ((item: T) => any) | string): T[];
224224

225225
/**
226226
* Tests if array contains specific object
@@ -232,13 +232,13 @@
232232
* Combines two arrays
233233
* @param array The array to combine
234234
*/
235-
Concat(array: Array<T>): Array<T>;
235+
Concat(array: T[]): T[];
236236

237237
/**
238238
* Combines two arrays but only applies values that are in both arrays
239239
* @param array The array to combine
240240
*/
241-
Intersect(array: Array<T>): Array<T>;
241+
Intersect(array: T[]): T[];
242242

243243
/**
244244
* Joins the entries by a given char
@@ -257,7 +257,7 @@
257257
/**
258258
* Reverses the array
259259
*/
260-
Reverse(): Array<T>;
260+
Reverse(): T[];
261261

262262
/**
263263
* Computes the average of the elements
@@ -277,20 +277,20 @@
277277
* Compares to sequences of objects
278278
* @param array The array to compare
279279
*/
280-
SequenceEqual(array: Array<T>): boolean;
280+
SequenceEqual(array: T[]): boolean;
281281

282282
/**
283283
* Combines the entries of two arrays using a custom function
284284
* @param array The array to combine
285285
* @param result The function (or function-string) to combine elements
286286
*/
287-
Zip<T, X>(array: Array<X>, result: ((first: T, second: X) => any) | string): Array<any>;
287+
Zip<T, X>(array: X[], result: ((first: T, second: X) => any) | string): any[];
288288

289289
/**
290290
* Combines two arrays without duplicates
291291
* @param array The array to combine
292292
*/
293-
Union(array: Array<T>): Array<T>;
293+
Union(array: T[]): T[];
294294

295295
/**
296296
* Converts the array to a dictionary

dev/Linq4JS.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

dev/Modules/Add.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Array.prototype.Add = function<T> (this: Array<T>, object: T, generateId?: boolean): Array<T> {
2-
let that: Array<T> = this;
1+
Array.prototype.Add = function<T> (this: T[], object: T, generateId?: boolean): T[] {
2+
let that: T[] = this;
33

44
if (object != null) {
55
if (generateId == true) {

dev/Modules/AddRange.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Array.prototype.AddRange = function<T> (this: Array<T>, objects: Array<T>, generateId: boolean): Array<T> {
2-
let that: Array<T> = this;
1+
Array.prototype.AddRange = function<T> (this: T[], objects: T[], generateId: boolean): T[] {
2+
let that: T[] = this;
33

44
objects.ForEach(function (x: T) {
55
that.Add(x, generateId);

dev/Modules/Aggregate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Array.prototype.Aggregate = function<T> (this: Array<T>, method: ((result: any, item: T) => any) | string, startVal?: any): string {
2-
let that: Array<T> = this;
1+
Array.prototype.Aggregate = function<T> (this: T[], method: ((result: any, item: T) => any) | string, startVal?: any): string {
2+
let that: T[] = this;
33

44
let result: any;
55

dev/Modules/All.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Array.prototype.All = function<T> (this: Array<T>, filter: ((item: T) => boolean) | string): boolean {
2-
let that: Array<T> = this;
1+
Array.prototype.All = function<T> (this: T[], filter: ((item: T) => boolean) | string): boolean {
2+
let that: T[] = this;
33

44
return that.Count(filter) == that.Count();
55
};

dev/Modules/Any.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Array.prototype.Any = function<T> (this: Array<T>, filter?: ((item: T) => boolean) | string): boolean {
2-
let that: Array<T> = this;
1+
Array.prototype.Any = function<T> (this: T[], filter?: ((item: T) => boolean) | string): boolean {
2+
let that: T[] = this;
33

44
return that.Count(filter) > 0;
55
};

dev/Modules/Average.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Array.prototype.Average = function <T>(this: Array<T>, selector?: ((item: T) => any) | string, filter?: ((item: T) => boolean) | string): number {
2-
let that: Array<T> = this;
1+
Array.prototype.Average = function <T>(this: T[], selector?: ((item: T) => any) | string, filter?: ((item: T) => boolean) | string): number {
2+
let that: T[] = this;
33

44
let result: number = 0;
55
let array: Array<any> = that;

dev/Modules/Clone.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
Array.prototype.Clone = function<T> (this: Array<T>): Array<T> {
2-
let that: Array<T> = this;
1+
Array.prototype.Clone = function<T> (this: T[]): T[] {
2+
let that: T[] = this;
33

4-
let newArray: Array<T> = new Array<T>();
4+
let newArray: T[] = [];
55

66
for (let obj of that) {
77
newArray.Add(obj);

dev/Modules/Concat.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Array.prototype.Concat = function<T> (this: Array<T>, array: Array<T>): Array<T> {
2-
let that: Array<T> = this;
1+
Array.prototype.Concat = function<T> (this: T[], array: T[]): T[] {
2+
let that: T[] = this;
33
that = that.concat(array);
44
return that;
55
};

0 commit comments

Comments
 (0)