Enumerate on promise resolved 0 ▲ Jake Worth 1 hour ago · Tech · hide · 0 comments For the golfers out there, we can combine these two lines into one: const items = await getCollection(); return items.sort(); This doesn’t work because sort() is being called on the promise returned by getCollection(): return await getCollection().sort(); // `sort()` runs on the Promise Instead, wrap the await expression in parentheses so sort() is called on the resolved value: return (await getCollection()).sort(); // `sort()` runs on the resolved array Promise documentation - MDN No comments yet. Log in to reply on the Fediverse. Comments will appear here.