After switching to flow 0.54.0 the following code fragment:
function runKarmaTest() {
const KARMA_CONFIG = {};
return new Promise(function (resolve, reject) {
new karma.Server(KARMA_CONFIG, function (exitCode) {
if (exitCode === 0) {
resolve();
} else {
reject(exitCode);
}
}).start();
});
}
reports the following error:
Error: scripts/runKarma.js:76
v----------------------------------------
76: return new Promise(function (resolve, reject) {
77: new karma.Server(KARMA_CONFIG, function (exitCode) {
78: if (exitCode === 0) {
...:
84: });
-^ type parameter `R` of constructor call. Missing annotation
in the line return new Promise(function (resolve, reject) {
and I cannot seem to figure out what's wrong ?
It looks like the thing it wants to know is the type of value wrapped by the promise. In this case it looks like it's just undefined
, since the success case doesn't give any value. You can probably annotate the function that returns this as returning a Promise<void>
or something like that to make this error go away.
It is curious that this happens in 0.54 and not before, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With