Skip to content

Commit

Permalink
avoid some anys
Browse files Browse the repository at this point in the history
  • Loading branch information
EskiMojo14 committed May 31, 2024
1 parent f0f8209 commit f54cbdd
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,10 @@ describe("buildCreateHistoryAdapter", () => {
});

it("exposes getInitialState", () => {
const initialState = createCustomHistoryAdapter().getInitialState([]);
expect(initialState).toEqual<CustomHistoryState<Array<any>>>({
const initialState = createCustomHistoryAdapter<
Array<number>
>().getInitialState([]);
expect(initialState).toEqual<CustomHistoryState<Array<number>>>({
past: [],
present: [],
future: [],
Expand All @@ -719,29 +721,29 @@ describe("buildCreateHistoryAdapter", () => {
});

it("updates the state correctly", () => {
const adapter = createCustomHistoryAdapter();
const adapter = createCustomHistoryAdapter<Array<number>>();
const add = adapter.undoable((state, value: number) => {
state.push(value);
});
const initialState = adapter.getInitialState([]);
const nextState = add(initialState, 1);
expect(nextState).toEqual<CustomHistoryState<Array<any>>>({
expect(nextState).toEqual<CustomHistoryState<Array<number>>>({
past: [{ data: [] }],
present: [1],
future: [],
paused: false,
extra: "extra",
});
const undoneState = adapter.undo(nextState);
expect(undoneState).toEqual<CustomHistoryState<Array<any>>>({
expect(undoneState).toEqual<CustomHistoryState<Array<number>>>({
past: [],
present: [],
future: [{ data: [1] }],
paused: false,
extra: "extra",
});
const redoneState = adapter.redo(undoneState);
expect(redoneState).toEqual<CustomHistoryState<Array<any>>>({
expect(redoneState).toEqual<CustomHistoryState<Array<number>>>({
past: [{ data: [] }],
present: [1],
future: [],
Expand Down

0 comments on commit f54cbdd

Please sign in to comment.