# @types/redux-duck

> TypeScript definitions for redux-duck

Latest version **1.0.3** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/redux-duck
pnpm add @types/redux-duck
yarn add @types/redux-duck
bun add @types/redux-duck
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2023-11-07 |
| First published | 2019-08-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51450 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/redux-duck
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/redux-duck
- npm.io page: https://npm.io/package/@types/redux-duck

## Dependencies (1)

- [redux](https://npm.io/package/redux.md) ^4.0.1

## Recent versions

- 1.0.3 (latest) — 2023-11-07
- 1.0.0 (ts3.1) — 2019-08-21
- 1.0.2 — 2023-10-18
- 1.0.1 — 2023-09-27

## README

# Installation
> `npm install --save @types/redux-duck`

# Summary
This package contains type definitions for redux-duck (https://github.com/PlatziDev/redux-duck/).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/redux-duck.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/redux-duck/index.d.ts)
````ts
// See redux-duck-tests.ts for an example application!

import { Action, AnyAction, Reducer } from "redux";
// import { FSA } from 'flux-standard-action';
// flux-standard-action contains mostly types so it is not a dependency of redux-duck javascript package
// flux-standard-action is written in javascript but the types are included in the same package
// flux-standard-action is not part of types-publisher dependencywhitelist
// https://github.com/redux-utilities/flux-standard-action/issues/119
// below is a minimalistic implementation that should work until the above questions are answered
export type FSAHack = Action<string> & {
    payload?: any;
};

export type AppName = string;
export type DuckName = string;
export type ActionName = string;

export type ActionType = string; // AppName/DuckName/ActionName or just DuckName/ActionName

// Ducks define FSA actions
export type ActionCreator<A extends FSAHack> = A extends { payload: any } ? (a: A["payload"]) => A
    : () => A;

// Ducks can listen for any actions (FSA or not)
export type ActionHandlers<S = any, A extends Action = AnyAction> = {
    [T in A["type"]]?: (x: S, y: Extract<A, { type: T }>) => S;
};

export interface DuckBuilder<AppAction extends Action = AnyAction> {
    defineType: (a: ActionName) => ActionType;
    createAction: <T extends string & AppAction["type"]>(a: T) => ActionCreator<Extract<AppAction, { type: T }>>;
    createReducer: <S>(a: ActionHandlers<S, AppAction>, b: S) => Reducer<S, AppAction>;
}

export function createDuck(a: DuckName, b?: AppName): DuckBuilder;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
 * Dependencies: [redux](https://npmjs.com/package/redux)

# Credits
These definitions were written by [Toni Ruottu](https://github.com/cyberixae).

---
_Source: https://npm.io/package/@types/redux-duck · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
