@@ -22,7 +22,7 @@ import { debounceSync } from './debounceSync';
22
22
* Return type of the effect, that behaves differently based on whether the
23
23
* argument is passed to the callback.
24
24
*/
25
- interface EffectReturnFn < T > {
25
+ export interface EffectReturnFn < T > {
26
26
( ) : void ;
27
27
( t : T | Observable < T > ) : Subscription ;
28
28
}
@@ -36,7 +36,7 @@ export class ComponentStore<T extends object> {
36
36
private readonly stateSubject$ = new ReplaySubject < T > ( 1 ) ;
37
37
private isInitialized = false ;
38
38
// Needs to be after destroy$ is declared because it's used in select.
39
- readonly state$ : Observable < T > = this . select ( s => s ) ;
39
+ readonly state$ : Observable < T > = this . select ( ( s ) => s ) ;
40
40
41
41
constructor ( defaultState ?: T ) {
42
42
// State can be initialized either through constructor, or initState or
@@ -80,22 +80,21 @@ export class ComponentStore<T extends object> {
80
80
: of ( observableOrValue ) ;
81
81
const subscription = observable$
82
82
. pipe (
83
- concatMap (
84
- value =>
85
- this . isInitialized
86
- ? of ( value ) . pipe ( withLatestFrom ( this . stateSubject$ ) )
87
- : // If state was not initialized, we'll throw an error.
88
- throwError (
89
- Error ( `${ this . constructor . name } has not been initialized` )
90
- )
83
+ concatMap ( ( value ) =>
84
+ this . isInitialized
85
+ ? of ( value ) . pipe ( withLatestFrom ( this . stateSubject$ ) )
86
+ : // If state was not initialized, we'll throw an error.
87
+ throwError (
88
+ Error ( `${ this . constructor . name } has not been initialized` )
89
+ )
91
90
) ,
92
91
takeUntil ( this . destroy$ )
93
92
)
94
93
. subscribe ( {
95
94
next : ( [ value , currentState ] ) => {
96
95
this . stateSubject$ . next ( updaterFn ( currentState , value ! ) ) ;
97
96
} ,
98
- error : error => {
97
+ error : ( error ) => {
99
98
initializationError = error ;
100
99
this . stateSubject$ . error ( error ) ;
101
100
} ,
@@ -211,7 +210,7 @@ export class ComponentStore<T extends object> {
211
210
const observable$ = isObservable ( observableOrValue )
212
211
? observableOrValue
213
212
: of ( observableOrValue ) ;
214
- return observable$ . pipe ( takeUntil ( this . destroy$ ) ) . subscribe ( value => {
213
+ return observable$ . pipe ( takeUntil ( this . destroy$ ) ) . subscribe ( ( value ) => {
215
214
// any new 👇 value is pushed into a stream
216
215
origin$ . next ( value ) ;
217
216
} ) ;
0 commit comments