Consider following code:
Promise.resolve('hello')
.then(a => console.log(a))
.catch(() => console.log("error"))
.then(() => console.log("ok"));
This gets me a very annoying error:
supplied parameters do not match any signature of call target: expected 0 parameter(s) but was called with 1 parameter(s)
Note that I only get this for the first .then(...)
, the catch and the second then are apparently no problem.
Just for the record; the code works and outputs
hello
ok
Maybe I should also mention that it actually compiles. I see the error in Visual Studio 2017. When I go to the definition of then it opens lib.es6.d.ts. Compilation happens with webpack 4 that uses TypeScript 2.8.3. In Visual Sudio I have installed TypeScript 2.8.1 (Can't find 2.8.3)
If someone could explain to me why this happens. And even better, how to get rid of it; that would be much appreciated.
I had the same issue and as the comment by @JBC alluded, it's caused by ReSharper. In my case I was running a rather old version (2017.1.1) so updating to the latest (or disabling it altogether) fixed it.