-
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
Typescript Operator Definition Incorrect? (map) #2272
Comments
@sam-s4s I believe this was a new feature added by TS 2.0. Are you using an older version of the TS compiler? cc'ing @kwonoj or @david-driscoll, who have more context about these sorts of changes. |
@trxcllnt Interesting! Thanks for the reply Paul :) I am using "typescript": "2.0.10", so you wouldn't think it could be that? |
Is it? I just tried and seems working fine. (latest @5.0.3 as well) https://travis-ci.org/kwonoj/rxjs-map-definition-test/builds/191204676 https://github.com/kwonoj/rxjs-map-definition-test/blob/master/index.ts#L4 |
I was picking 2.0.1 to match with issue, but for me 2.1 also worked. |
Ah, it can't be the editor, because I get the exact same error when I do a command line build. So Visual Studio and the Typescript compiler both give me the same error... I'll just try a fresh project, with nothing in it but Typescript and Rxjs... |
Ok I got to the bottom of it :D 3 problems... First was that the newer version of rxjs had changed, and things like map are now map<T, R>. So that was making the compiler die, and rightly so. That part is fine. Secondly, and more the issue, the newer version of rxjs had been changed to Typescript 2, and Visual Studio 2015 did not support some of those features, so even if the code was correct, VS2015 would think it was an error (couldn't even read the types correctly). Thirdly, annoyingly, the official angular2 website says to install Typescript 2 for VS2015, but links to an installer that actually completely breaks TS support in VS2015... Awesome. I've made a github issue for that here: angular/angular.io#3102 So the overall solution to the problem, just in case anyone read this and has the same problem, is that you do need to install Typescript 2 for VS2015, but at the time of posting, that can be found here: So install that, fix the dual typed issue, and all is good :) |
Yes, visual studio has its own toolset and you need to reconfigure it, compare to other editors does honor npm installed local modules. (i.e #1696) . VS2017 might resolve this issues better. Closing issue as resolved for now. |
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. |
RxJS version:
5.0.1
Code to reproduce:
let obs = Observable.of(1, 2, 3);
let m = obs.map((n: number) => n + 1); // Yields error - "Supplied parameters do not match any signature of call target."
Expected behavior:
Code should compile.
Actual behavior:
Code yields the error "Supplied parameters do not match any signature of call target."
Additional information:
This used to work correctly using rxjs 5.0.0-beta.12.
In version 5.0.1, the type definition file (map.d.ts) contains the following signature:
However, the javascript file contains the following signature:
I know very little of the context behind the changes in rxjs, but it appears that the addition of the "this: Observable" parameter in the new signature is causing the problem, as when this parameter is removed, the problem goes away... (and both the parameter and the problem were not present in 5.0.0-beta.12).
I've checked, and it appears that all of the other operators also have this additional parameter in the new version (and thus none of them work).
It appears to make all operators in rxjs completely unusable.
I'm not sure if it's something I'm doing wrong, or if someone's stuffed up the type definition files? And I'm surprised that this (breaking change) hasn't stopped everyone else from using rxjs, too... which makes me wonder if it's just me!
Any help with this would be greatly appreciated!
The text was updated successfully, but these errors were encountered: