File tree 1 file changed +4
-4
lines changed
packages/toolkit/src/entities
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'
2
2
import type {
3
3
IdSelector ,
4
4
Update ,
@@ -36,8 +36,8 @@ export function ensureEntitiesArray<T, Id extends EntityId>(
36
36
return entities
37
37
}
38
38
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
41
41
}
42
42
43
43
export function splitAddedUpdatedEntities < T , Id extends EntityId > (
@@ -47,7 +47,7 @@ export function splitAddedUpdatedEntities<T, Id extends EntityId>(
47
47
) : [ T [ ] , Update < T , Id > [ ] , Id [ ] ] {
48
48
newEntities = ensureEntitiesArray ( newEntities )
49
49
50
- const existingIdsArray = getCurrent ( state . ids ) as Id [ ]
50
+ const existingIdsArray = getCurrent ( state . ids )
51
51
const existingIds = new Set < Id > ( existingIdsArray )
52
52
53
53
const added : T [ ] = [ ]
You can’t perform that action at this time.
0 commit comments