Skip to content

Commit

Permalink
fix types/test for state setting
Browse files Browse the repository at this point in the history
  • Loading branch information
akmjenkins committed Oct 15, 2021
1 parent c36c5d9 commit 32688fb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type StateSetter<T> = ((state: T) => T) | T;
export type StateSetter<T> = (state: T) => T;

type Unsubscribe = () => void;
type Subscriber<T> = (state: T) => void;
Expand Down
8 changes: 0 additions & 8 deletions test/state.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ describe('state', () => {
expect(s.getState()).toStrictEqual({ fetching: true, error: true });
});

it('should set state ', () => {
const myState = { fetching: false, error: true };
const s = state(myState);
expect(s.getState()).toBe(myState);
s.setState({ ...myState, fetching: true });
expect(s.getState()).toStrictEqual({ fetching: true, error: true });
});

it('should subscribe', () => {
type StateType = boolean | { fetching: boolean; error: boolean };
const myState = { fetching: false, error: true };
Expand Down

0 comments on commit 32688fb

Please sign in to comment.