Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

immer-reducer

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

immer-reducer - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

4

lib/immer-reducer.d.ts

@@ -34,3 +34,3 @@ import { Draft } from "immer";

interface ImmerReducerFunction<T extends ImmerReducerClass> {
(state: ImmerReducerState<T> | undefined, action: ReturnTypeUnion<ActionCreators<T>>): ImmerReducerState<T> | undefined;
(state: ImmerReducerState<T> | undefined, action: ReturnTypeUnion<ActionCreators<T>>): ImmerReducerState<T>;
}

@@ -51,3 +51,3 @@ /** generate ActionCreators types from the ImmerReducer class */

export declare function createActionCreators<T extends ImmerReducerClass>(immerReducerClass: T): ActionCreators<T>;
export declare function createReducerFunction<T extends ImmerReducerClass>(immerReducerClass: T): ImmerReducerFunction<T>;
export declare function createReducerFunction<T extends ImmerReducerClass>(immerReducerClass: T, initialState?: ImmerReducerState<T>): ImmerReducerFunction<T>;
export {};

@@ -47,4 +47,7 @@ "use strict";

exports.createActionCreators = createActionCreators;
function createReducerFunction(immerReducerClass) {
function createReducerFunction(immerReducerClass, initialState) {
return function immerReducerFunction(state, action) {
if (state === undefined) {
state = initialState;
}
if (!action.type.startsWith(PREFIX + ":")) {

@@ -58,3 +61,3 @@ return state;

if (!state) {
throw new Error("ImmerReducer does not support undefined state. Pass initial state to createStore()");
throw new Error("ImmerReducer does not support undefined state. Pass initial state to createReducerFunction() or createStore()");
}

@@ -61,0 +64,0 @@ return immer_1.default(state, function (draftState) {

{
"name": "immer-reducer",
"version": "0.1.2",
"version": "0.1.3",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/immer-reducer.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc