You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which package is this bug report for? If unsure which one to select, leave blank
@crawlee/core
Issue description
According to the documentation "If no memo is passed to the initial invocation of reduce, the iteratee() is not invoked on the first element of the list. The first element is instead passed as the memo in the invocation of the iteratee() on the next element in the list.". But according to the type definitions, reduces second parameter is non-optional, and all items will be of the same type as the parameter passed (e.g. If one passes undefined, the type of the item will be undefined even though it should be Data).
Code sample
constdataset=Dataset.open(/* some dataset id */)// Causes type-error: `Expected 2-3 arguments, but got 1`dataset.reduce(async(acc,next)=>{next});// Causes type-error: `Type 'Promise<Dictionary>' is not assignable to type 'Awaitable<undefined>'` with a ton of explanation - the problem is that the type of `next` is `Dictionary`, whereas reduce is expecting the function to return an `undefined`dataset.reduce(async(acc,next)=>{next},undefined);
Package version
upstream
Node.js version
N/A
Operating system
N/A
Apify platform
Tick me if you encountered this issue on the Apify platform
I have tested this on the next release
upstream
Other context
No response
The text was updated successfully, but these errors were encountered:
Which package is this bug report for? If unsure which one to select, leave blank
@crawlee/core
Issue description
According to the documentation "If no
memo
is passed to the initial invocation of reduce, theiteratee()
is not invoked on the first element of the list. The first element is instead passed as the memo in the invocation of theiteratee()
on the next element in the list.". But according to the type definitions,reduce
s second parameter is non-optional, and all items will be of the same type as the parameter passed (e.g. If one passes undefined, the type of the item will beundefined
even though it should beData
).Code sample
Package version
upstream
Node.js version
N/A
Operating system
N/A
Apify platform
I have tested this on the
next
releaseupstream
Other context
No response
The text was updated successfully, but these errors were encountered: