Skip to content

Commit 9929fd3

Browse files
committed
Update examples.
1 parent ea8883d commit 9929fd3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

types/collectionsjs/collectionsjs-tests.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ collection.contains(stark => stark.name === 'John Snow'); // $ExpectType boolean
3030
collection.count(); // $ExpectType number
3131
collection.each(stark => stark.age = 3); // $ExpectType Collection<{ name: string; age: number; }>
3232
collection.filter(stark => stark.age === 14); // $ExpectType Collection<{ name: string; age: number; }>
33-
collection.find('bran'); // $ExpectType number
33+
collection.find({ name: 'Bran Stark', age: 7 }); // $ExpectType number
3434
collection.first(item => item.age > 7); // $ExpectType { name: string; age: number; }
3535
collection.flatten(true); // $ExpectType Collection<{ name: string; age: number; }>
3636
collection.get(2); // $ExpectType { name: string; age: number; }
@@ -41,7 +41,11 @@ collection.last(); // $ExpectType { name: string; age: number; }
4141
collection.map(stark => stark.name); // $ExpectType Collection<{ name: string; age: number; }>
4242
collection.pluck('name'); // $ExpectType Collection<{ name: string; age: number; }>
4343
collection.push({name: 'Robb Stark', age: 17}); // $ExpectType Collection<{ name: string; age: number; }>
44-
collection.reduce((previous, current) => previous.age + current.age, 0); // $ExpectType any
44+
45+
const value = new Collection([1, 2, 3]).reduce(
46+
(previous, current) => previous + current,
47+
0
48+
); // $ExpectType number
4549
collection.reject(stark => stark.age < 14); // $ExpectType Collection<{ name: string; age: number; }>
4650
collection.remove({name: 'Robb Stark', age: 17}); // $ExpectType boolean
4751
collection.reverse(); // $ExpectType Collection<{ name: string; age: number; }>

0 commit comments

Comments
 (0)