From 4ab6c95f09a28d52ffba0311100b46f63e987406 Mon Sep 17 00:00:00 2001 From: Andrew Bulat Date: Wed, 17 Jul 2024 12:12:51 +0100 Subject: [PATCH] Fix PaginatedResult.next() usage PaginatedResult.next() type was updated in ably-js v2 [1] to return null in case of no page. [1] https://github.com/ably/ably-js/commit/8bd17068f8e444f36ad86ce13ffecf0b4ba04456 --- src/CursorHistory.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CursorHistory.ts b/src/CursorHistory.ts index 349c8221..2d13ee61 100644 --- a/src/CursorHistory.ts +++ b/src/CursorHistory.ts @@ -76,7 +76,8 @@ export default class CursorHistory { pageNo++; while (pageNo <= paginationLimit && this.positionsMissing(connections) && history.hasNext()) { - page = await history.next(); + // assert result of .next() is non null as we've checked .hasNext() before + page = (await history.next())!; connections = this.allCursorUpdates(connections, page); pageNo++; }