I'm having trouble understanding the type for a JQueryPromise. I'd like my promise to be of type void, but while the interface definition accepts a void I don't know how to return/cast the promise to match the interface signature. When I compile I get the error:
Call signatures of types '() => JQueryPromise<{}>' and '() => JQueryPromise' are incompatible.
Here's a sample of the code:
module Sample {
export interface Ifoo {
bar: () => JQueryPromise<void>;
}
export class fooClass implements Ifoo {
bar() {
var result = $.Deferred();
// logic
return result.promise();
}
}
}
What am I doing wrong; or what could I be doing right?
Thanks!
-John
Use <void>
when creating the defferred:
module Sample {
export interface Ifoo {
bar: () => JQueryPromise<void>;
}
export class fooClass implements Ifoo {
bar() {
var result = $.Deferred<void>();
// logic
return result.promise();
}
}
}
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