I've installed jquery and @types/jquery. I want to use jquery.Deferred() but when i try to use it I get error that "$.Deferred is not a function".
import * as $ from "jquery";
u
// somewhere in code
let dfd = $.Deferred<
{ response: JQueryXHR; body?: any },
{ response: JQueryXHR; errorThrown: string }
>();
It is from code that was generated by https://github.com/OpenAPITools/openapi-generator for typescript. I'm using it in React Native app. Any suggestions? Thanks!
$.Deferred
is virtually obsolete now in modern browsers due to built in Promise API – DisclosurePromise
instead of$.Deferred
. If you want to return a value that has been deferred, returnPromise.resolve(someValue)
. If you want to return a deferred error,Promise.reject(someError)
. Etc. – Impugn