Skip to content

Commit

Permalink
fix: Fixing initializer type for useState
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Jun 10, 2021
1 parent 014750e commit d7cab1b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hooks/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ export type StateUpdater<S> = (value: S | ((prevState: S) => S)) => void;
*/
export function useState<S>(initialState: S | (() => S)): [S, StateUpdater<S>];

export function useState<S = undefined>(): [
S | undefined,
StateUpdater<S | undefined>
];

export type Reducer<S, A> = (prevState: S, action: A) => S;
/**
* An alternative to `useState`.
Expand Down

0 comments on commit d7cab1b

Please sign in to comment.