File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed
libs/ngrx-toolkit/src/lib/devtools Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change
1
+ import { signalStore , withMethods } from '@ngrx/signals' ;
2
+ import { setAllEntities , withEntities } from '@ngrx/signals/entities' ;
3
+ import { setLoaded , withCallState } from '../../with-call-state' ;
4
+ import { updateState } from '../update-state' ;
5
+
6
+ describe ( 'updateState' , ( ) => {
7
+ it ( 'should work with multiple updaters' , ( ) => {
8
+ interface Item {
9
+ id : string ;
10
+ name : string ;
11
+ }
12
+
13
+ signalStore (
14
+ withEntities < Item > ( ) ,
15
+ withCallState ( { collection : 'items' } ) ,
16
+ withMethods ( ( store ) => ( {
17
+ loadItems ( ) {
18
+ // This should not cause a type error
19
+ updateState (
20
+ store ,
21
+ 'Items loaded successfully' ,
22
+ setAllEntities ( [ ] as Item [ ] ) ,
23
+ setLoaded ( 'items' ) ,
24
+ ) ;
25
+ } ,
26
+ } ) ) ,
27
+ ) ;
28
+ } ) ;
29
+ } ) ;
Original file line number Diff line number Diff line change 3
3
PartialStateUpdater ,
4
4
WritableStateSource ,
5
5
} from '@ngrx/signals' ;
6
- import { Prettify } from '../shared/prettify' ;
7
6
import { currentActionNames } from './internal/current-action-names' ;
8
7
9
8
type PatchFn = typeof originalPatchState extends (
@@ -31,7 +30,7 @@ export function updateState<State extends object>(
31
30
stateSource : WritableStateSource < State > ,
32
31
action : string ,
33
32
...updaters : Array <
34
- Partial < Prettify < State > > | PartialStateUpdater < Prettify < State > >
33
+ Partial < NoInfer < State > > | PartialStateUpdater < NoInfer < State > >
35
34
>
36
35
) : void {
37
36
currentActionNames . add ( action ) ;
You can’t perform that action at this time.
0 commit comments