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
If migrateItem() is defined as migrateItem(item: Record<string, AttributeValue>): Promise<Record<string, AttributeValue>> {...}, then the return type from asl.map is Promise<Promise<Record<string, AttributeValue>>[]> (promise for array of promises). In the example code, another await would be required to resolve back to the actual resolved value.
It seems that the definition of Map<Input,Output>'s iterator is incorrect in not mentioning Promise. The following definition produces the correct output (paraphrased) whilst allowing the iterator to be async or not.
The difference between asl.map and Array.map is that the former allows for concurrency control via the maxConcurrency property, whilst the latter uses Map defaults, which is unconstrained concurrency. Not being able to wrap asl.map in Promise.all means that there is no option to control concurrency.
Example code
If
migrateItem()
is defined asmigrateItem(item: Record<string, AttributeValue>): Promise<Record<string, AttributeValue>> {...}
, then the return type fromasl.map
isPromise<Promise<Record<string, AttributeValue>>[]>
(promise for array of promises). In the example code, another await would be required to resolve back to the actual resolved value.It seems that the definition of
Map<Input,Output>
'siterator
is incorrect in not mentioningPromise
. The following definition produces the correct output (paraphrased) whilst allowing the iterator to be async or not.It may be possible to force the correct type using coercion (as a workaround):
The text was updated successfully, but these errors were encountered: