File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
packages/toolkit/src/entities Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 1- import { current , isDraft } from 'immer'
1+ import { Draft , current , isDraft } from 'immer'
22import type {
33 IdSelector ,
44 Update ,
@@ -36,8 +36,8 @@ export function ensureEntitiesArray<T, Id extends EntityId>(
3636 return entities
3737}
3838
39- export function getCurrent < T > ( value : T ) : T {
40- return isDraft ( value ) ? current ( value ) : value
39+ export function getCurrent < T > ( value : T | Draft < T > ) : T {
40+ return ( isDraft ( value ) ? current ( value ) : value ) as T
4141}
4242
4343export function splitAddedUpdatedEntities < T , Id extends EntityId > (
@@ -47,7 +47,7 @@ export function splitAddedUpdatedEntities<T, Id extends EntityId>(
4747) : [ T [ ] , Update < T , Id > [ ] , Id [ ] ] {
4848 newEntities = ensureEntitiesArray ( newEntities )
4949
50- const existingIdsArray = getCurrent ( state . ids ) as Id [ ]
50+ const existingIdsArray = getCurrent ( state . ids )
5151 const existingIds = new Set < Id > ( existingIdsArray )
5252
5353 const added : T [ ] = [ ]
You can’t perform that action at this time.
0 commit comments