# typescript-fsa-redux-saga

> TypeScript FSA utilities for redux-saga

Latest version **2.0.0** (published 2019-09-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install typescript-fsa-redux-saga
pnpm add typescript-fsa-redux-saga
yarn add typescript-fsa-redux-saga
bun add typescript-fsa-redux-saga
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-09-14 |
| First published | 2017-03-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 11.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 61 |
| Author | Daniel Lytkin |
| Maintainers | aikoven |
| Keywords | redux-saga, typescript, action, action creator |

## Links

- npm: https://www.npmjs.com/package/typescript-fsa-redux-saga
- Repository: https://github.com/aikoven/typescript-fsa-redux-saga
- Homepage: https://github.com/aikoven/typescript-fsa-redux-saga#readme
- Issues: https://github.com/aikoven/typescript-fsa-redux-saga/issues
- npm.io page: https://npm.io/package/typescript-fsa-redux-saga

## Dependencies (3)

- [tslib](https://npm.io/package/tslib.md) ^1.7.1
- [redux-saga](https://npm.io/package/redux-saga.md) ^1.0.0
- [typescript-fsa](https://npm.io/package/typescript-fsa.md) ^3.0.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2019-09-14
- 2.0.0-beta.1 — 2019-01-21
- 2.0.0-beta.0 — 2019-01-10
- 1.1.1 — 2018-09-21
- 1.1.0 — 2018-05-16
- 1.0.3 — 2017-09-15
- 1.0.2 — 2017-05-11
- 1.0.1 — 2017-03-09
- 1.0.0 — 2017-03-03

## README

# [TypeScript FSA](https://github.com/aikoven/typescript-fsa) utilities for redux-saga [![npm version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]

## Installation

```
npm install --save typescript-fsa-redux-saga
```

## API

### `bindAsyncAction(actionCreators: AsyncActionCreators, options?: BindAsyncActionOptions): HigherOrderSaga`

Creates higher-order-saga that wraps target saga with async actions.
Resulting saga dispatches `started` action once started and `done`/`failed`
upon finish.

#### Options

* `skipStartedAction`: Set to `true` if you want to use `started` action as a
  trigger instead of an event. This is useful when using
  `takeLatest`/`takeEvery` and you want to avoid having to manually dispatch an
  extra trigger action. This way, you only have to manually dispatch an
  `started` action, and saga will dispatch `done`/`failed` upon finish.


**Example:**

```ts
// actions.ts
import actionCreatorFactory from 'typescript-fsa';

const actionCreator = actionCreatorFactory();

// specify parameters and result shapes as generic type arguments
export const doSomething =
  actionCreator.async<{foo: string},   // parameter type
                      {bar: number}    // result type
                     >('DO_SOMETHING');

// saga.ts
import {SagaIterator} from 'redux-saga';
import {call} from 'redux-saga/effects';
import {doSomething} from './actions';

const doSomethingWorker = bindAsyncAction(doSomething)(
  function* (params): SagaIterator {
    // `params` type is `{foo: string}`
    const bar = yield call(fetchSomething, params.foo);
    return {bar};
  },
);

function* mySaga(): SagaIterator {
  yield call(doSomethingWorker, {foo: 'lol'});
}
```

[npm-image]: https://badge.fury.io/js/typescript-fsa-redux-saga.svg
[npm-url]: https://badge.fury.io/js/typescript-fsa-redux-saga
[travis-image]: https://travis-ci.org/aikoven/typescript-fsa-redux-saga.svg?branch=master
[travis-url]: https://travis-ci.org/aikoven/typescript-fsa-redux-saga

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