Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(node/TS): eliminate incompatable types to protected properties #3544

Merged
merged 1 commit into from
Apr 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/internal/AsyncSubject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export class AsyncSubject<T> extends Subject<T> {
private hasNext: boolean = false;
private hasCompleted: boolean = false;

protected _subscribe(subscriber: Subscriber<any>): Subscription {
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<any>): Subscription {
if (this.hasError) {
subscriber.error(this.thrownError);
return Subscription.EMPTY;
Expand Down
3 changes: 2 additions & 1 deletion src/internal/BehaviorSubject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export class BehaviorSubject<T> extends Subject<T> {
return this.getValue();
}

protected _subscribe(subscriber: Subscriber<T>): Subscription {
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<T>): Subscription {
const subscription = super._subscribe(subscriber);
if (subscription && !(<SubscriptionLike>subscription).closed) {
subscriber.next(this._value);
Expand Down
13 changes: 8 additions & 5 deletions src/internal/Observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ export class Observable<T> implements Subscribable<T> {
/** Internal implementation detail, do not use directly. */
public _isScalar: boolean = false;

protected source: Observable<any>;
/** @deprecated This is an internal implementation detail, do not use. */
source: Observable<any>;

protected operator: Operator<any, T>;
/** @deprecated This is an internal implementation detail, do not use. */
operator: Operator<any, T>;

/**
* @constructor
Expand Down Expand Up @@ -208,7 +210,8 @@ export class Observable<T> implements Subscribable<T> {
return sink;
}

protected _trySubscribe(sink: Subscriber<T>): TeardownLogic {
/** @deprecated This is an internal implementation detail, do not use. */
_trySubscribe(sink: Subscriber<T>): TeardownLogic {
try {
return this._subscribe(sink);
} catch (err) {
Expand Down Expand Up @@ -247,8 +250,8 @@ export class Observable<T> implements Subscribable<T> {
}) as Promise<void>;
}

/** @internal */
protected _subscribe(subscriber: Subscriber<any>): TeardownLogic {
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<any>): TeardownLogic {
const { source } = this;
return source && source.subscribe(subscriber);
}
Expand Down
3 changes: 2 additions & 1 deletion src/internal/ReplaySubject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export class ReplaySubject<T> extends Subject<T> {
super.next(value);
}

protected _subscribe(subscriber: Subscriber<T>): Subscription {
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<T>): Subscription {
// When `_infiniteTimeWindow === true` then the buffer is already trimmed
const _infiniteTimeWindow = this._infiniteTimeWindow;
const _events = _infiniteTimeWindow ? this._events : this._trimBufferThenGetEvents();
Expand Down
9 changes: 6 additions & 3 deletions src/internal/Subject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,17 @@ export class Subject<T> extends Observable<T> implements SubscriptionLike {
this.observers = null;
}

protected _trySubscribe(subscriber: Subscriber<T>): TeardownLogic {
/** @deprecated This is an internal implementation detail, do not use. */
_trySubscribe(subscriber: Subscriber<T>): TeardownLogic {
if (this.closed) {
throw new ObjectUnsubscribedError();
} else {
return super._trySubscribe(subscriber);
}
}

protected _subscribe(subscriber: Subscriber<T>): Subscription {
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<T>): Subscription {
if (this.closed) {
throw new ObjectUnsubscribedError();
} else if (this.hasError) {
Expand Down Expand Up @@ -160,7 +162,8 @@ export class AnonymousSubject<T> extends Subject<T> {
}
}

protected _subscribe(subscriber: Subscriber<T>): Subscription {
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<T>): Subscription {
const { source } = this;
if (source) {
return this.source.subscribe(subscriber);
Expand Down
6 changes: 4 additions & 2 deletions src/internal/Subscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ export class Subscriber<T> extends Subscription implements Observer<T> {
this.unsubscribe();
}

protected _unsubscribeAndRecycle(): Subscriber<T> {
/** @deprecated This is an internal implementation detail, do not use. */
_unsubscribeAndRecycle(): Subscriber<T> {
const { _parent, _parents } = this;
this._parent = null;
this._parents = null;
Expand Down Expand Up @@ -296,7 +297,8 @@ class SafeSubscriber<T> extends Subscriber<T> {
return false;
}

protected _unsubscribe(): void {
/** @deprecated This is an internal implementation detail, do not use. */
_unsubscribe(): void {
const { _parentSubscriber } = this;
this._context = null;
this._parentSubscriber = null;
Expand Down
5 changes: 3 additions & 2 deletions src/internal/observable/ConnectableObservable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ export class ConnectableObservable<T> extends Observable<T> {
/** @internal */
_isComplete = false;

constructor(protected source: Observable<T>,
constructor(public source: Observable<T>,
protected subjectFactory: () => Subject<T>) {
super();
}

protected _subscribe(subscriber: Subscriber<T>) {
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<T>) {
return this.getSubject().subscribe(subscriber);
}

Expand Down
3 changes: 2 additions & 1 deletion src/internal/observable/SubscribeOnObservable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export class SubscribeOnObservable<T> extends Observable<T> {
}
}

protected _subscribe(subscriber: Subscriber<T>) {
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<T>) {
const delay = this.delayTime;
const source = this.source;
const scheduler = this.scheduler;
Expand Down
3 changes: 2 additions & 1 deletion src/internal/observable/dom/AjaxObservable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ export class AjaxObservable<T> extends Observable<T> {
this.request = request;
}

protected _subscribe(subscriber: Subscriber<T>): TeardownLogic {
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<T>): TeardownLogic {
return new AjaxSubscriber(subscriber, this.request);
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/internal/observable/dom/WebSocketSubject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ export class WebSocketSubject<T> extends AnonymousSubject<T> {

private _config: WebSocketSubjectConfig<T>;

protected _output: Subject<T>;
/** @deprecated This is an internal implementation detail, do not use. */
_output: Subject<T>;

private _socket: WebSocket;

Expand Down Expand Up @@ -263,7 +264,8 @@ export class WebSocketSubject<T> extends AnonymousSubject<T> {
};
}

protected _subscribe(subscriber: Subscriber<T>): Subscription {
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<T>): Subscription {
const { source } = this;
if (source) {
return source.subscribe(subscriber);
Expand Down
3 changes: 2 additions & 1 deletion src/internal/operators/bufferTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ class BufferTimeSubscriber<T> extends Subscriber<T> {
super._complete();
}

protected _unsubscribe() {
/** @deprecated This is an internal implementation detail, do not use. */
_unsubscribe() {
this.contexts = null;
}

Expand Down
3 changes: 2 additions & 1 deletion src/internal/operators/bufferWhen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ class BufferWhenSubscriber<T> extends OuterSubscriber<T, any> {
super._complete();
}

protected _unsubscribe() {
/** @deprecated This is an internal implementation detail, do not use. */
_unsubscribe() {
this.buffer = null;
this.subscribing = false;
}
Expand Down
5 changes: 3 additions & 2 deletions src/internal/operators/delayWhen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,12 @@ class DelayWhenSubscriber<T, R> extends OuterSubscriber<T, R> {
* @extends {Ignored}
*/
class SubscriptionDelayObservable<T> extends Observable<T> {
constructor(protected source: Observable<T>, private subscriptionDelay: Observable<any>) {
constructor(public source: Observable<T>, private subscriptionDelay: Observable<any>) {
super();
}

protected _subscribe(subscriber: Subscriber<T>) {
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<T>) {
this.subscriptionDelay.subscribe(new SubscriptionDelaySubscriber(subscriber, this.source));
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/internal/operators/groupBy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ class GroupDurationSubscriber<K, T> extends Subscriber<T> {
this.complete();
}

protected _unsubscribe() {
/** @deprecated This is an internal implementation detail, do not use. */
_unsubscribe() {
const { parent, key } = this;
this.key = this.parent = null;
if (parent) {
Expand All @@ -258,7 +259,8 @@ export class GroupedObservable<K, T> extends Observable<T> {
super();
}

protected _subscribe(subscriber: Subscriber<T>) {
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<T>) {
const subscription = new Subscription();
const { refCountSubscription, groupSubject } = this;
if (refCountSubscription && !refCountSubscription.closed) {
Expand Down
6 changes: 4 additions & 2 deletions src/internal/operators/repeatWhen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class RepeatWhenSubscriber<T, R> extends OuterSubscriber<T, R> {
}
}

protected _unsubscribe() {
/** @deprecated This is an internal implementation detail, do not use. */
_unsubscribe() {
const { notifications, retriesSubscription } = this;
if (notifications) {
notifications.unsubscribe();
Expand All @@ -99,7 +100,8 @@ class RepeatWhenSubscriber<T, R> extends OuterSubscriber<T, R> {
this.retries = null;
}

protected _unsubscribeAndRecycle(): Subscriber<T> {
/** @deprecated This is an internal implementation detail, do not use. */
_unsubscribeAndRecycle(): Subscriber<T> {
const { _unsubscribe } = this;

this._unsubscribe = null;
Expand Down
3 changes: 2 additions & 1 deletion src/internal/operators/retryWhen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class RetryWhenSubscriber<T, R> extends OuterSubscriber<T, R> {
}
}

protected _unsubscribe() {
/** @deprecated This is an internal implementation detail, do not use. */
_unsubscribe() {
const { errors, retriesSubscription } = this;
if (errors) {
errors.unsubscribe();
Expand Down
3 changes: 2 additions & 1 deletion src/internal/operators/timeoutWith.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ class TimeoutWithSubscriber<T, R> extends OuterSubscriber<T, R> {
super._next(value);
}

protected _unsubscribe() {
/** @deprecated This is an internal implementation detail, do not use. */
_unsubscribe() {
this.action = null;
this.scheduler = null;
this.withObservable = null;
Expand Down
3 changes: 2 additions & 1 deletion src/internal/operators/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ class WindowSubscriber<T> extends OuterSubscriber<T, any> {
this.destination.complete();
}

protected _unsubscribe() {
/** @deprecated This is an internal implementation detail, do not use. */
_unsubscribe() {
this.window = null;
}

Expand Down
3 changes: 2 additions & 1 deletion src/internal/operators/windowToggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ class WindowToggleSubscriber<T, O> extends OuterSubscriber<T, any> {
super._complete();
}

protected _unsubscribe() {
/** @deprecated This is an internal implementation detail, do not use. */
_unsubscribe() {
const { contexts } = this;
this.contexts = null;
if (contexts) {
Expand Down
3 changes: 2 additions & 1 deletion src/internal/scheduler/AsyncAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ export class AsyncAction<T> extends Action<T> {
}
}

protected _unsubscribe() {
/** @deprecated This is an internal implementation detail, do not use. */
_unsubscribe() {

const id = this.id;
const scheduler = this.scheduler;
Expand Down
3 changes: 2 additions & 1 deletion src/internal/testing/HotObservable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export class HotObservable<T> extends Subject<T> implements SubscriptionLoggable
this.scheduler = scheduler;
}

protected _subscribe(subscriber: Subscriber<any>): Subscription {
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<any>): Subscription {
const subject: HotObservable<T> = this;
const index = subject.logSubscribedFrame();
subscriber.add(new Subscription(() => {
Expand Down