File tree Expand file tree Collapse file tree 1 file changed +4
-16
lines changed
Expand file tree Collapse file tree 1 file changed +4
-16
lines changed Original file line number Diff line number Diff line change @@ -4,30 +4,18 @@ import {
44 type Patches ,
55 type Options ,
66 type Draft ,
7+ type PatchesOptions ,
78} from 'mutative' ;
89import {
910 useState ,
1011 useReducer ,
1112 useCallback ,
1213 useMemo ,
1314 useRef ,
14- Dispatch ,
15+ type Dispatch ,
1516 useEffect ,
1617} from 'react' ;
1718
18- type PatchesOptions =
19- | boolean
20- | {
21- /**
22- * The default value is `true`. If it's `true`, the path will be an array, otherwise it is a string.
23- */
24- pathAsArray ?: boolean ;
25- /**
26- * The default value is `true`. If it's `true`, the array length will be included in the patches, otherwise no include array length.
27- */
28- arrayLengthAssignment ?: boolean ;
29- } ;
30-
3119type DraftFunction < S > = ( draft : Draft < S > ) => void ;
3220type Updater < S > = ( value : S | ( ( ) => S ) | DraftFunction < S > ) => void ;
3321
@@ -302,12 +290,12 @@ function useMutativeReducer<
302290 }
303291 } ) ;
304292 return options ?. enablePatches
305- ? [
293+ ? ( [
306294 result [ 0 ] ,
307295 result [ 1 ] ,
308296 patchesRef . current . patches ,
309297 patchesRef . current . inversePatches ,
310- ] as ReducerResult < S , A , O , F >
298+ ] as ReducerResult < S , A , O , F > )
311299 : result ;
312300}
313301
You can’t perform that action at this time.
0 commit comments