1- import { Observable } from '../Observable' ;
21import { innerFrom } from '../observable/innerFrom' ;
32import { Subject } from '../Subject' ;
43import { SafeSubscriber } from '../Subscriber' ;
54import { Subscription } from '../Subscription' ;
6- import { MonoTypeOperatorFunction , SubjectLike } from '../types' ;
5+ import { MonoTypeOperatorFunction , SubjectLike , ObservableInput } from '../types' ;
76import { operate } from '../util/lift' ;
87
98export interface ShareConfig < T > {
@@ -13,37 +12,37 @@ export interface ShareConfig<T> {
1312 */
1413 connector ?: ( ) => SubjectLike < T > ;
1514 /**
16- * If true, the resulting observable will reset internal state on error from source and return to a "cold" state. This
15+ * If ` true` , the resulting observable will reset internal state on error from source and return to a "cold" state. This
1716 * allows the resulting observable to be "retried" in the event of an error.
18- * If false, when an error comes from the source it will push the error into the connecting subject, and the subject
17+ * If ` false` , when an error comes from the source it will push the error into the connecting subject, and the subject
1918 * will remain the connecting subject, meaning the resulting observable will not go "cold" again, and subsequent retries
2019 * or resubscriptions will resubscribe to that same subject. In all cases, RxJS subjects will emit the same error again, however
2120 * {@link ReplaySubject} will also push its buffered values before pushing the error.
22- * It is also possible to pass a notifier factory returning an observable instead which grants more fine-grained
21+ * It is also possible to pass a notifier factory returning an `ObservableInput` instead which grants more fine-grained
2322 * control over how and when the reset should happen. This allows behaviors like conditional or delayed resets.
2423 */
25- resetOnError ?: boolean | ( ( error : any ) => Observable < any > ) ;
24+ resetOnError ?: boolean | ( ( error : any ) => ObservableInput < any > ) ;
2625 /**
27- * If true, the resulting observable will reset internal state on completion from source and return to a "cold" state. This
26+ * If ` true` , the resulting observable will reset internal state on completion from source and return to a "cold" state. This
2827 * allows the resulting observable to be "repeated" after it is done.
29- * If false, when the source completes, it will push the completion through the connecting subject, and the subject
28+ * If ` false` , when the source completes, it will push the completion through the connecting subject, and the subject
3029 * will remain the connecting subject, meaning the resulting observable will not go "cold" again, and subsequent repeats
3130 * or resubscriptions will resubscribe to that same subject.
32- * It is also possible to pass a notifier factory returning an observable instead which grants more fine-grained
31+ * It is also possible to pass a notifier factory returning an `ObservableInput` instead which grants more fine-grained
3332 * control over how and when the reset should happen. This allows behaviors like conditional or delayed resets.
3433 */
35- resetOnComplete ?: boolean | ( ( ) => Observable < any > ) ;
34+ resetOnComplete ?: boolean | ( ( ) => ObservableInput < any > ) ;
3635 /**
37- * If true, when the number of subscribers to the resulting observable reaches zero due to those subscribers unsubscribing, the
36+ * If ` true` , when the number of subscribers to the resulting observable reaches zero due to those subscribers unsubscribing, the
3837 * internal state will be reset and the resulting observable will return to a "cold" state. This means that the next
3938 * time the resulting observable is subscribed to, a new subject will be created and the source will be subscribed to
4039 * again.
41- * If false, when the number of subscribers to the resulting observable reaches zero due to unsubscription, the subject
40+ * If ` false` , when the number of subscribers to the resulting observable reaches zero due to unsubscription, the subject
4241 * will remain connected to the source, and new subscriptions to the result will be connected through that same subject.
43- * It is also possible to pass a notifier factory returning an observable instead which grants more fine-grained
42+ * It is also possible to pass a notifier factory returning an `ObservableInput` instead which grants more fine-grained
4443 * control over how and when the reset should happen. This allows behaviors like conditional or delayed resets.
4544 */
46- resetOnRefCountZero ?: boolean | ( ( ) => Observable < any > ) ;
45+ resetOnRefCountZero ?: boolean | ( ( ) => ObservableInput < any > ) ;
4746}
4847
4948export function share < T > ( ) : MonoTypeOperatorFunction < T > ;
@@ -245,7 +244,7 @@ export function share<T>(options: ShareConfig<T> = {}): MonoTypeOperatorFunction
245244
246245function handleReset < T extends unknown [ ] = never [ ] > (
247246 reset : ( ) => void ,
248- on : boolean | ( ( ...args : T ) => Observable < any > ) ,
247+ on : boolean | ( ( ...args : T ) => ObservableInput < any > ) ,
249248 ...args : T
250249) : Subscription | undefined {
251250 if ( on === true ) {
@@ -264,5 +263,5 @@ function handleReset<T extends unknown[] = never[]>(
264263 } ,
265264 } ) ;
266265
267- return on ( ...args ) . subscribe ( onSubscriber ) ;
266+ return innerFrom ( on ( ...args ) ) . subscribe ( onSubscriber ) ;
268267}
0 commit comments