open-index/open-npm huggingface dataset:
npm package: @practicaljs/ts-kit
Description: Set of TS utilities to use with or without react
Author: Harlen Alvarez
Latest version: 0.1.1

Usage

### Create Reducer and Actions

```ts
  type User = {
    name: string,
    age: number
  }
  const UserActions = {
    setName: (state: User, {payload}: Action<string>) => {
      return { ...state, name: payload };
    }
  } satisfies ReducerActions<User>

  const [state, dispatch] = useReducer(createReducer(UserActions), initState)
  const actions = createActions(UserActions, dispatch)
  actions.setName('foo')
```