-
Notifications
You must be signed in to change notification settings - Fork 3k
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): enable ' --noUnusedLocals' option #2104
Conversation
…ble. BREAKING CHANGE - `ErrorObservable.create()` (`Obserbable.throw()`) takes a new type parameter `E` that express a error type instead on old one's `T`. Their functions return `ErrorObservable<E>`. It is still the drived type of `Observable<any>`, it's not changed from old one. But it contains the error typed as `E` now.
edfc143
to
4a0ec5c
Compare
@@ -55,7 +55,8 @@ export class ArrayLikeObservable<T> extends Observable<T> { | |||
|
|||
protected _subscribe(subscriber: Subscriber<T>): TeardownLogic { | |||
let index = 0; | |||
const { arrayLike, scheduler } = this; | |||
const arrayLike = this.arrayLike; | |||
const scheduler = this.scheduler; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason? I think we want to keep our existing, destructure style. Is there a subtle difference I'm missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for to avoid a TypeScript compiler's bug (It will be fixed in TS2.1).
constructor(private time: number, | ||
private notification: any) { | ||
constructor(public time: number, | ||
public notification: Notification<T>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did these need to change from private to public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old code was wrong. These members should be public to be used in DelaySubscriber
@@ -58,7 +58,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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this need to be changed to not be a private property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defaultValue
is not used in LastSubscriber
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this option make it the error.
queue: QueueScheduler; | ||
animationFrame: AnimationFrameScheduler; | ||
async: AsyncScheduler; | ||
} = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these annotations necessary? I figured TS could easily infer the types from the assignment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't make it, TypeScript compiler make it error (This might be a compiler's issue?). But there is no problem. We can avoid such error with just writing expliciltly code.
4a0ec5c
to
3c1ead2
Compare
Discussed this one at our last meeting and we decided we want to keep the existing behavior because we haven't noticed any practical issues with our current way and this makes debugging harder--leaving unused variables while we're fixing something, but being reminded if we forget by the separate linting phase before commit. Thanks @saneyuki for your contribution! |
Okay. I accept this decision. I might open a new pull request which remove some needless code detected by |
…ll() - This commit is spin-off of ReactiveX#2104
…ll() - This commit is spin-off of ReactiveX#2104
…ll() - This commit is spin-off of ReactiveX#2104
…ll() - This commit is spin-off of ReactiveX#2104
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description:
no-unused-variable
(But not now).Related issue (if exists):
E
for ErrorObservable. #2071