1
- import { map , Observable , of , pipe , switchMap , tap } from 'rxjs' ;
2
- import { rxMethod } from '@ngrx/signals/rxjs-interop' ;
3
- import { HttpClient } from '@angular/common/http' ;
4
- import { inject } from '@angular/core' ;
5
- import { signalStore , SignalStoreFeature } from '@ngrx/signals' ;
1
+ import { Observable } from 'rxjs' ;
2
+ import { SignalStoreFeature } from '@ngrx/signals' ;
6
3
import {
7
4
EmptyFeatureResult ,
8
5
SignalStoreFeatureResult ,
@@ -23,15 +20,17 @@ type ActionsCreator<Spec extends ActionsSpec> = Extract<
23
20
'private' | 'public'
24
21
> extends never
25
22
? {
26
- [ ActionName in keyof Spec ] : Spec [ ActionName ] & { type : ActionName } ;
23
+ [ ActionName in keyof Spec ] : Spec [ ActionName ] & {
24
+ type : ActionName & string ;
25
+ } ;
27
26
}
28
27
: {
29
28
[ ActionName in keyof Spec [ 'private' ] ] : Spec [ 'private' ] [ ActionName ] & {
30
- type : ActionName ;
29
+ type : ActionName & string ;
31
30
} ;
32
31
} & {
33
32
[ ActionName in keyof Spec [ 'public' ] ] : Spec [ 'public' ] [ ActionName ] & {
34
- type : ActionName ;
33
+ type : ActionName & string ;
35
34
} ;
36
35
} ;
37
36
@@ -40,11 +39,13 @@ type PublicActions<Spec extends ActionsSpec> = Extract<
40
39
'private' | 'public'
41
40
> extends never
42
41
? {
43
- [ ActionName in keyof Spec ] : Spec [ ActionName ] & { type : ActionName } ;
42
+ [ ActionName in keyof Spec ] : Spec [ ActionName ] & {
43
+ type : ActionName & string ;
44
+ } ;
44
45
}
45
46
: {
46
47
[ ActionName in keyof Spec [ 'public' ] ] : Spec [ 'public' ] [ ActionName ] & {
47
- type : ActionName ;
48
+ type : ActionName & string ;
48
49
} ;
49
50
} ;
50
51
@@ -58,19 +59,13 @@ export declare function createActions<Spec extends ActionsSpec>(
58
59
spec : Spec
59
60
) : ActionsCreator < Spec > ;
60
61
61
- type ActionsFactory < StateActions extends Actions > = ( ) => StateActions ;
62
-
63
62
type ReducerFn < A extends Action = Action > = (
64
63
action : A ,
65
64
reducerFn : ( action : A , state : State ) => State
66
65
) => void ;
67
66
68
67
type ReducerFactory < A extends Actions > = ( on : ReducerFn , actions : A ) => void ;
69
68
70
- type EffectFn < A extends Action = Action > = {
71
- ( action : A , effect : ( action : Observable < A > ) => Observable < Action > ) : void ;
72
- } ;
73
-
74
69
type EffectsFactory < StateActions extends Actions > = (
75
70
actions : StateActions ,
76
71
forAction : < EffectAction extends Action > (
@@ -90,14 +85,14 @@ type EffectsFactory<StateActions extends Actions> = (
90
85
*/
91
86
export declare function withRedux <
92
87
Spec extends ActionsSpec ,
93
- StateActions extends Actions ,
94
- Input extends SignalStoreFeatureResult
88
+ Input extends SignalStoreFeatureResult ,
89
+ StoreActions extends ActionsCreator < Spec > = ActionsCreator < Spec > ,
90
+ PublicStoreActions extends PublicActions < Spec > = PublicActions < Spec >
95
91
> ( redux : {
96
- actions : StateActions ;
97
- // actions: (actionsCreator: (spec: ActionsSpec) => StateActions) => void;
98
- reducer : ReducerFactory < StateActions > ;
99
- effects : EffectsFactory < StateActions > ;
92
+ actions : Spec ;
93
+ reducer : ReducerFactory < StoreActions > ;
94
+ effects : EffectsFactory < StoreActions > ;
100
95
} ) : SignalStoreFeature <
101
96
Input ,
102
- EmptyFeatureResult & { methods : { actions : ( ) => StateActions } }
97
+ EmptyFeatureResult & { methods : { actions : ( ) => PublicStoreActions } }
103
98
> ;
0 commit comments