From c81e4e2d95944b0c8c02d68cc736226e44a237f2 Mon Sep 17 00:00:00 2001 From: Donorlin Date: Tue, 15 Feb 2022 10:34:58 +0100 Subject: [PATCH] Restore entries attribute in MemoryHistory interface --- packages/history/__tests__/memory-test.js | 4 ++++ packages/history/index.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/packages/history/__tests__/memory-test.js b/packages/history/__tests__/memory-test.js index fdbf4bdd1..6fa770d38 100644 --- a/packages/history/__tests__/memory-test.js +++ b/packages/history/__tests__/memory-test.js @@ -27,6 +27,10 @@ describe('a memory history', () => { expect(typeof history.index).toBe('number'); }); + it('has an entries property', () => { + expect(Array.isArray(history.entries)).toBe(true); + }); + it('knows how to create hrefs', () => { const href = history.createHref({ pathname: '/the/path', diff --git a/packages/history/index.ts b/packages/history/index.ts index e38d9bbcf..a46899a47 100644 --- a/packages/history/index.ts +++ b/packages/history/index.ts @@ -315,6 +315,7 @@ export interface HashHistory extends History {} */ export interface MemoryHistory extends History { readonly index: number; + readonly entries: Location[]; } const readOnly: (obj: T) => Readonly = __DEV__ @@ -973,6 +974,9 @@ export function createMemoryHistory( get index() { return index; }, + get entries() { + return entries; + }, get action() { return action; },