Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore entries attribute in MemoryHistory interface #939

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/history/__tests__/memory-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions packages/history/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ export interface HashHistory extends History {}
*/
export interface MemoryHistory extends History {
readonly index: number;
readonly entries: Location[];
}

const readOnly: <T>(obj: T) => Readonly<T> = __DEV__
Expand Down Expand Up @@ -973,6 +974,9 @@ export function createMemoryHistory(
get index() {
return index;
},
get entries() {
return entries;
},
get action() {
return action;
},
Expand Down