-
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
fix: make TS type def of VirtualAction compatible with TS >= 2.6 #3813
fix: make TS type def of VirtualAction compatible with TS >= 2.6 #3813
Conversation
I'm not sure why this change to If this is something that needs to be fixed in |
I don't know what branch I should "compare" it to. It is a type fix for v5, and master is v6. The v6 have already "fixed" this in a different way, because the behavior has changed. But I will not be able to migrate my company's codebase to v6 any time soon. So hopefully you're still patching up v5. |
So are you saying that the changes like this one cannot be used or don't solve the problem with TypeScript 2.0? I'm wondering why your PR fixes the problem a different way, that's all. |
No they cannot, due to stricter type checking in TypeScript >= 2.6. When extending class AsyncAction<T> {
protected work: (this: AsyncAction<T>, state?: T) => void;
}
class VirtualAction<T> extends AsyncAction<T> {
protected work: (this: VirtualAction<T>, state?: T) => void; // Error
} The class AsyncAction<T> {
protected work: (this: this, state?: T) => void;
}
class VirtualAction<T> extends AsyncAction<T> {
protected work: (this: this, state?: T) => void; // works - compatible and the this binding refers to VirtualAction as it should.
} |
Hmm.. now I understand what you mean. The PR you're refering to is not available in v5 right? It is only available in v6? |
My understanding is that this commit fixed the problem in constructor(protected scheduler: AsyncScheduler,
protected work: (this: Action<T>, state?: T) => void) {
super(scheduler, work);
} constructor(protected scheduler: QueueScheduler,
protected work: (this: Action<T>, state?: T) => void) {
super(scheduler, work);
} Is there a reason why similar changes cannot be applied to |
You're correct sir. I thought the fix only "applies" to v6. But sure, the fix to stable, if you are up for pathing up v5, should be made in the same manner. Any suggestions how to move forward? :) |
Whether or not it's something that really needs to be fixed in Given that the problem can - it seems - be worked around using However, if the problem is going to be fixed in v5 ( |
Thanks for the effort you've put into the PR, BTW. |
@benlesh What do you think of the problem this PR seeks to address? Is it something that users of v5 should just work around using |
Thanks a lot for your feedback. It is totally reasonable, and I do understand the complication in creating new releases, and futhermore patching up and maintaining "older" versions. Do you know the full extend of the Does it mean if I interface with let's say the VirtualAction type, that I won't get type errors all together (I can pass anything to library functions) and arguments will not be typechecked against rxjs types, or does it mean "just" mean that the type defs of the libraries won't break the compilation if they're not sound internally? |
I use My understanding is that it skips the checking of the internals of packages within As stated in the docs that accompanied its release of
|
Thanks a lot, it even sounds like something that you always want. :) |
We'll discuss this at the core team meeting. My gut says to leave it as is, and try to get people to move to v6 (for a variety of reasons). |
The position of the TypeScript team is that " |
I'm on the fence here. v5 was only ever targeting TS 2.0 or 2.1... At the same time, this appears to be a non-breaking change. |
I suppose, since it's not a breaking change for TS 2.0 and 2.1 users, and it solves a problem for people using newer versions of TypeScript, we can merge it... but I'd recommend getting off of 5.5 very soon. |
Description:
I ran into a problem when using RxJS 5.5.11 with typescript newer than 2.6.
The type def for
VirtualAction
fromrxjs/scheduler/VirtualTimeScheduler
is not compatible with newer typescript, so I cannot compile my project.Related issue (if exists):
Fixes: #3031