Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@ typings/

# next.js build output
.next

# Transpiled code
dist
27 changes: 27 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
modules: false,
},
],
'@babel/preset-react',
],
plugins: [
'@babel/plugin-proposal-class-properties',
],
env: {
production: {
plugins: [
'@babel/plugin-transform-react-inline-elements',
'@babel/plugin-transform-react-constant-elements',
],
},
test: {
plugins: [
'@babel/plugin-transform-modules-commonjs',
],
},
},
};
20 changes: 20 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { ComponentType } from "react";
import { Reducer, StoreEnhancer } from "redux";
import { Saga, Task } from "redux-saga";

export function forceReducerReload(store: {});
export function createInjectorsEnhancer(options: {
runSaga: <S extends Saga<any[]>>(saga: S, ...args: Parameters<S>) => Task,
createReducer: (injectedReducers: { [key: string]: Reducer }) => Reducer
}): StoreEnhancer;

export enum SagaInjectionModes {
RESTART_ON_REMOUNT = "@@saga-injector/restart-on-remount",
DAEMON = "@@saga-injector/daemon",
ONCE_TILL_UNMOUNT = "@@saga-injector/once-till-unmount"
}

export function injectSaga(options: { key: string, saga: Saga, mode?: SagaInjectionModes }): <T extends ComponentType>(Component: T) => T;
export function injectReducer(options: { key: string, reducer: Reducer }): <T extends ComponentType>(Component: T) => T;
export function useInjectSaga(options: { key: string, saga: Saga, mode?: SagaInjectionModes }): void;
export function useInjectReducer(options: { key: string, reducer: Reducer }): void;
15 changes: 15 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html

module.exports = {
coverageDirectory: "coverage",
coverageThreshold: {
global: {
statements: 100,
branches: 100,
functions: 100,
lines: 100,
},
},
setupFiles: ["core-js/stable", "regenerator-runtime/runtime"],
};
Loading