Gathering detailed insights and metrics for typed-redux-saga
Gathering detailed insights and metrics for typed-redux-saga
Gathering detailed insights and metrics for typed-redux-saga
Gathering detailed insights and metrics for typed-redux-saga
@jambit/eslint-plugin-typed-redux-saga
These are eslint rules to help with typed-redux-saga
swc-plugin-typed-redux-saga
[](https://www.npmjs.com/package/swc-plugin-typed-redux-saga)
redux-saga-area
simplified strongly typed redux (with saga)
@iiiristram/sagun
Strongly-typed service-based isomorphic architecture on top of redux-saga
An attempt to bring better TypeScript typing to redux-saga.
npm install typed-redux-saga
Typescript
Module System
Min. Node Version
90.6
Supply Chain
88.1
Quality
80.1
Maintenance
100
Vulnerability
99.6
License
TypeScript (52.92%)
JavaScript (40.59%)
Nunjucks (6.49%)
Total Downloads
8,320,439
Last Day
17,170
Last Week
83,106
Last Month
370,989
Last Year
2,513,207
MIT License
315 Stars
702 Commits
34 Forks
8 Watchers
17 Branches
12 Contributors
Updated on Sep 26, 2024
Minified
Minified + Gzipped
Latest Version
1.5.0
Package Id
typed-redux-saga@1.5.0
Unpacked Size
112.53 kB
Size
26.93 kB
File Count
58
Cumulative downloads
Total Downloads
Last Day
-4.3%
17,170
Compared to previous day
Last Week
-10.1%
83,106
Compared to previous week
Last Month
60.6%
370,989
Compared to previous month
Last Year
35%
2,513,207
Compared to previous year
1
31
2
An attempt to bring better TypeScript typing to redux-saga.
Requires TypeScript 3.6 or later.
1# yarn 2yarn add typed-redux-saga 3 4# npm 5npm install typed-redux-saga
Let's take the example from https://redux-saga.js.org/#sagasjs
1import { call, all } from "redux-saga/effects"; 2// Let's assume Api.fetchUser() returns Promise<User> 3// Api.fetchConfig1/fetchConfig2 returns Promise<Config1>, Promise<Config2> 4import Api from "..."; 5 6function* fetchUser(action) { 7 // `user` has type any 8 const user = yield call(Api.fetchUser, action.payload.userId); 9 ... 10} 11 12function* fetchConfig() {} 13 // `result` has type any 14 const result = yield all({ 15 api1: call(Api.fetchConfig1), 16 api2: call(Api.fetchConfig2), 17 }); 18 ... 19}
1// Note we import `call` from typed-redux-saga 2import { call, all } from "typed-redux-saga"; 3// Let's assume Api.fetchUser() returns Promise<User> 4// Api.fetchConfig1/fetchConfig2 returns Promise<Config1>, Promise<Config2> 5import Api from "..."; 6 7function* fetchUser(action) { 8 // Note yield is replaced with yield* 9 // `user` now has type User, not any! 10 const user = yield* call(Api.fetchUser, action.payload.userId); 11 ... 12} 13 14function* fetchConfig() {} 15 // Note yield is replaced with yield* 16 // `result` now has type {api1: Config1, api2: Config2} 17 const result = yield* all({ 18 api1: call(Api.fetchConfig1), 19 api2: call(Api.fetchConfig2), 20 }); 21 ... 22}
You can use the built-in babel macro that will take care of transforming all your effects to raw redux-saga effects.
Install the babel macros plugin:
1yarn add --dev babel-plugin-macros
Modify your import names to use the macro:
1import {call, race} from "typed-redux-saga/macro"; 2 3// And use the library normally 4function* myEffect() { 5 yield* call(() => "foo"); 6}
The previous code will be transpiled at compile time to raw redux-saga effects:
1import {call, race} from "redux-saga/effects"; 2 3function* myEffect() { 4 yield call(() => 'foo'); 5}
This gives you all the benefits of strong types during development without
the overhead induced by all the calls to typed-redux-saga
's proxies.
In order to avoid accidentally importing the original effects instead of the typed effects, you can use this ESLint plugin: https://github.com/jambit/eslint-plugin-typed-redux-saga
It includes an auto-fix option, so you can use it to easily convert your codebase from redux-saga to typed-redux-saga!
Thanks to all the contributors and especially thanks to @gilbsgilbs for his huge contribution.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 3/10 approved changesets -- score normalized to 3
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
21 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-05-12
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More