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
You should never use toArray() when you don’t have to. The whole point of the iterator (i.e. what you get by calling the Symbol.iterator method) is to not have to eagerly evaluate all of the results. cts.search() returns a ValueIterator (in MarkLogic 8) which is (confusingly) bother an iterator and and iterable. I don't know the TypeScript-specific issue here, but here’s a polyfill for ES2016 Map type that exposes its interface.
Edit: Here’s a better explanation. I can’t tell if IterableIterator is built-in to TypeScript or something one has to define herself, though.
Here is a snippet of JS that works in QConsole:
Here is the same code written in TS:
Without the
.toArray()
, the resulting JS output from the TS transpiler doesn’t work.The text was updated successfully, but these errors were encountered: