Skip to content

Commit

Permalink
Support immer 9.x
Browse files Browse the repository at this point in the history
  • Loading branch information
esamattis committed Mar 23, 2021
1 parent 1e1ecdd commit 50df0a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
"typescript": "^3.9.9"
},
"dependencies": {
"immer": "^1.4.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^8.0.0"
"immer": "^1.4.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^8.0.0 || ^9.0.0"
}
}
9 changes: 5 additions & 4 deletions src/immer-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,14 @@ export function createReducerFunction<T extends ImmerReducerClass>(
return reducers.draftState;
}

// Workaround typing changes in Immer 3.x. This does not actually
return draftState;

// Workaround typing changes in Immer 9.x. This does not actually
// affect the exposed types by immer-reducer itself.

// Also using immer internally with anys like this allow us to
// support multiple versions of immer from 1.4 to 3.x
return draftState as any;
});
// support multiple versions of immer.
}) as any;
};
}

Expand Down

0 comments on commit 50df0a4

Please sign in to comment.