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

style(linting): remove needless members detected by noUnusedLocals #2125

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
22f7e48
style(linting): clarify the type of 2nd argument of Operator<T, R>.ca…
tetsuharuohzeki Nov 10, 2016
4b45798
style(linting): remove needless member from ForkJoinSubscriber
tetsuharuohzeki Nov 10, 2016
34bf613
style(linting): remove needless member from BufferTimeSubscriber
tetsuharuohzeki Nov 10, 2016
ca38575
style(linting): remove needless member from BufferToggleSubscriber
tetsuharuohzeki Nov 10, 2016
3974138
style(linting): remove needless type param T from concatStatic
tetsuharuohzeki Nov 10, 2016
d8c76f4
refactor(delay): clarify internal types of DelaySubscriber
tetsuharuohzeki Nov 10, 2016
5433f64
style(linting): remove needless member from LastSubscriber
tetsuharuohzeki Nov 10, 2016
773c459
style(linting): remove needless type param T from mergeStatic
tetsuharuohzeki Nov 10, 2016
57f6beb
style(linting): remove needless members from SampleTimeSubscriber
tetsuharuohzeki Nov 10, 2016
52989f0
style(linting): remove needless members from SequenceEqualSubscriber
tetsuharuohzeki Nov 10, 2016
62ccfeb
style(linting): remove needless members from TakeUntilSubscriber
tetsuharuohzeki Nov 10, 2016
feec754
style(linting): remove needless members from WindowTimeSubscriber
tetsuharuohzeki Nov 10, 2016
0aea52a
style(linting): remove needless members from WithLatestFromSubscriber
tetsuharuohzeki Nov 10, 2016
63d01e0
style(linting): remove needless type param T from zipStatic
tetsuharuohzeki Nov 10, 2016
86f2e6f
style(linting): remove needless type param T from minimalSetImpl
tetsuharuohzeki Nov 10, 2016
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/Operator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Observable } from './Observable';
import { Subscriber } from './Subscriber';
import { TeardownLogic } from './Subscription';

export interface Operator<T, R> {
call(subscriber: Subscriber<R>, source: any): TeardownLogic;
call(subscriber: Subscriber<R>, source: Observable<T>): TeardownLogic;
}
2 changes: 1 addition & 1 deletion src/observable/ForkJoinObservable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class ForkJoinSubscriber<T> extends OuterSubscriber<T, T> {
private haveValues = 0;

constructor(destination: Subscriber<T>,
private sources: Array<SubscribableOrPromise<any>>,
sources: Array<SubscribableOrPromise<any>>,
private resultSelector?: (...values: Array<any>) => T) {
super(destination);

Expand Down
2 changes: 1 addition & 1 deletion src/operator/bufferTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class BufferTimeSubscriber<T> extends Subscriber<T> {

constructor(destination: Subscriber<T[]>,
private bufferTimeSpan: number,
private bufferCreationInterval: number,
bufferCreationInterval: number,
private maxBufferSize: number,
private scheduler: Scheduler) {
super(destination);
Expand Down
2 changes: 1 addition & 1 deletion src/operator/bufferToggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class BufferToggleSubscriber<T, O> extends OuterSubscriber<T, O> {
private contexts: Array<BufferContext<T>> = [];

constructor(destination: Subscriber<T[]>,
private openings: SubscribableOrPromise<O>,
openings: SubscribableOrPromise<O>,
private closingSelector: (value: O) => SubscribableOrPromise<any> | void) {
super(destination);
this.add(subscribeToResult(this, openings));
Expand Down
2 changes: 1 addition & 1 deletion src/operator/concat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export function concatStatic<T, R>(...observables: (ObservableInput<any> | Sched
* @name concat
* @owner Observable
*/
export function concatStatic<T, R>(...observables: Array<ObservableInput<any> | Scheduler>): Observable<R> {
export function concatStatic<R>(...observables: Array<ObservableInput<any> | Scheduler>): Observable<R> {
let scheduler: Scheduler = null;
let args = <any[]>observables;
if (isScheduler(args[observables.length - 1])) {
Expand Down
22 changes: 15 additions & 7 deletions src/operator/delay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { async } from '../scheduler/async';
import { isDate } from '../util/isDate';
import { Operator } from '../Operator';
import { Scheduler } from '../Scheduler';
import { Action } from '../scheduler/Action';
import { Subscriber } from '../Subscriber';
import { Notification } from '../Notification';
import { Observable } from '../Observable';
import { PartialObserver } from '../Observer';
import { TeardownLogic } from '../Subscription';

/**
Expand Down Expand Up @@ -63,17 +65,23 @@ class DelayOperator<T> implements Operator<T, T> {
}
}

interface DelayState<T> {
source: DelaySubscriber<T>;
destination: PartialObserver<T>;
scheduler: Scheduler;
}

/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
class DelaySubscriber<T> extends Subscriber<T> {
private queue: Array<any> = [];
private queue: Array<DelayMessage<T>> = [];
private active: boolean = false;
private errored: boolean = false;

private static dispatch(state: any): void {
private static dispatch<T>(this: Action<DelayState<T>>, state: DelayState<T>): void {
const source = state.source;
const queue = source.queue;
const scheduler = state.scheduler;
Expand All @@ -85,7 +93,7 @@ class DelaySubscriber<T> extends Subscriber<T> {

if (queue.length > 0) {
const delay = Math.max(0, queue[0].time - scheduler.now());
(<any> this).schedule(state, delay);
this.schedule(state, delay);
} else {
source.active = false;
}
Expand All @@ -99,12 +107,12 @@ class DelaySubscriber<T> extends Subscriber<T> {

private _schedule(scheduler: Scheduler): void {
this.active = true;
this.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, {
this.add(scheduler.schedule<DelayState<T>>(DelaySubscriber.dispatch, this.delay, {
source: this, destination: this.destination, scheduler: scheduler
}));
}

private scheduleNotification(notification: Notification<any>): void {
private scheduleNotification(notification: Notification<T>): void {
if (this.errored === true) {
return;
}
Expand Down Expand Up @@ -134,7 +142,7 @@ class DelaySubscriber<T> extends Subscriber<T> {
}

class DelayMessage<T> {
constructor(private time: number,
private notification: any) {
constructor(public time: number,
public notification: Notification<T>) {
}
}
2 changes: 1 addition & 1 deletion src/operator/last.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class LastSubscriber<T, R> extends Subscriber<T> {
constructor(destination: Subscriber<R>,
private predicate?: (value: T, index: number, source: Observable<T>) => boolean,
private resultSelector?: ((value: T, index: number) => R) | void,
private defaultValue?: any,
defaultValue?: any,
private source?: Observable<T>) {
super(destination);
if (typeof defaultValue !== 'undefined') {
Expand Down
2 changes: 1 addition & 1 deletion src/operator/merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export function mergeStatic<T, R>(...observables: (ObservableInput<any> | Schedu
* @name merge
* @owner Observable
*/
export function mergeStatic<T, R>(...observables: Array<ObservableInput<any> | Scheduler | number>): Observable<R> {
export function mergeStatic<R>(...observables: Array<ObservableInput<any> | Scheduler | number>): Observable<R> {
let concurrent = Number.POSITIVE_INFINITY;
let scheduler: Scheduler = null;
let last: any = observables[observables.length - 1];
Expand Down
11 changes: 8 additions & 3 deletions src/operator/sampleTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ class SampleTimeSubscriber<T> extends Subscriber<T> {
hasValue: boolean = false;

constructor(destination: Subscriber<T>,
private period: number,
private scheduler: Scheduler) {
period: number,
scheduler: Scheduler) {
super(destination);
this.add(scheduler.schedule(dispatchNotification, period, { subscriber: this, period }));
}
Expand All @@ -85,7 +85,12 @@ class SampleTimeSubscriber<T> extends Subscriber<T> {
}
}

function dispatchNotification<T>(this: Action<any>, state: any) {
interface SampleTimeState<T> {
subscriber: SampleTimeSubscriber<T>;
period: number;
}

function dispatchNotification<T>(this: Action<SampleTimeState<T>>, state: SampleTimeState<T>) {
let { subscriber, period } = state;
subscriber.notifyNext();
this.schedule(state, period);
Expand Down
2 changes: 1 addition & 1 deletion src/operator/sequenceEqual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class SequenceEqualSubscriber<T, R> extends Subscriber<T> {
private _oneComplete = false;

constructor(destination: Observer<R>,
private compareTo: Observable<T>,
compareTo: Observable<T>,
private comparor: (a: T, b: T) => boolean) {
super(destination);
this.add(compareTo.subscribe(new SequenceEqualCompareToSubscriber(destination, this)));
Expand Down
2 changes: 1 addition & 1 deletion src/operator/takeUntil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class TakeUntilOperator<T> implements Operator<T, T> {
class TakeUntilSubscriber<T, R> extends OuterSubscriber<T, R> {

constructor(destination: Subscriber<any>,
private notifier: Observable<any>) {
notifier: Observable<any>) {
super(destination);
this.add(subscribeToResult(this, notifier));
}
Expand Down
6 changes: 3 additions & 3 deletions src/operator/windowTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ class WindowTimeSubscriber<T> extends Subscriber<T> {
private windows: Subject<T>[] = [];

constructor(protected destination: Subscriber<Observable<T>>,
private windowTimeSpan: number,
private windowCreationInterval: number,
private scheduler: Scheduler) {
windowTimeSpan: number,
windowCreationInterval: number,
scheduler: Scheduler) {
super(destination);
if (windowCreationInterval !== null && windowCreationInterval >= 0) {
let window = this.openWindow();
Expand Down
2 changes: 1 addition & 1 deletion src/operator/withLatestFrom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class WithLatestFromSubscriber<T, R> extends OuterSubscriber<T, R> {
private toRespond: number[] = [];

constructor(destination: Subscriber<R>,
private observables: Observable<any>[],
observables: Observable<any>[],
private project?: (...values: any[]) => Observable<R>) {
super(destination);
const len = observables.length;
Expand Down
2 changes: 1 addition & 1 deletion src/operator/zip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function zipStatic<R>(...observables: Array<ObservableInput<any> | ((...v
* @name zip
* @owner Observable
*/
export function zipStatic<T, R>(...observables: Array<ObservableInput<any> | ((...values: Array<any>) => R)>): Observable<R> {
export function zipStatic<R>(...observables: Array<ObservableInput<any> | ((...values: Array<any>) => R)>): Observable<R> {
const project = <((...ys: Array<any>) => R)> observables[observables.length - 1];
if (typeof project === 'function') {
observables.pop();
Expand Down
2 changes: 1 addition & 1 deletion src/util/Set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface ISet<T> {
clear(): void;
}

export function minimalSetImpl<T>(): ISetCtor {
export function minimalSetImpl(): ISetCtor {
// THIS IS NOT a full impl of Set, this is just the minimum
// bits of functionality we need for this library.
return class MinimalSet<T> implements ISet<T> {
Expand Down