In my project, I was using [email protected]
and it was working fine, but now I updated its version to latest [email protected]
and it is giving me a lot of errors. I am unable to find anything in documentations and not getting any Idea how to resolve this issue.
here is my code:
dbPool.query(`DELETE FROM table WHERE Id='${Id}'`, () => resolve())
Another one is:
return new Promise((resolve, reject) => {
this.redis.SET(addr, resp, () => resolve())
})
These both are giving me error:
error TS2794: Expected 1 arguments, but got 0. Did you forget to include 'void' in your type argument to 'Promise'?
Any idea what should I pass in resolve()
to resolve this issue??
Did you forget to include 'void' in your type argument to Promise" occurs when we use the Promise constructor without passing it an argument. To solve the error, use a generic to type the value of the Promise to void .
specifically for the case of defining a function as () => void , the function won't check the return value at all and you can return anything (even a promise). Defining a function as async will just wrap the return value in a promise, which the () => void type will just ignore.
Did you forget to include 'void' in your type argument to Promise" occurs when we use the Promise constructor without passing it an argument. To solve the error, use a generic to type the value of the Promise to void. Here is an example of how the error occurs. Copied!
error TS2794: Expected 1 arguments, but got 0. Did you forget to include 'void' in your type argument to 'Promise'? error TS2794: Expected 1 arguments, but got 0. Did you forget to include 'void' in your type argument to 'Promise'? error TS2345: Argument of type ' (value: unknown) => void' is not assignable to parameter of type ' () => void'.
What is TypeError: sorted expected 1 argument, got 0? Computer scientist for 11+ years and passionate about math since childhood. Author has 6.1K answers and 5.7M answer views 2 y It means that you called the sorted () function without any arguments, and it expects an argument. For example (this is copy-pasted straight from an IPython session)
The error "Expected 1 argument, but got 0" occurs when we invoke a function that takes 1 parameter, without passing it any arguments. To solve the error, pass the required argument to the function, provide a default value for it or mark the parameter as optional. Here is an example of how the error occurs.
The standard argument for resolve
in your case is unknown
, which means that an argument is required;
If you don't want resolve
to be taking any arguments you can explicitly set the generic type of Promise
to void
;
return new Promise<void>((resolve, reject) => {
this.red.SET(addr, resp, () => resolve())
})
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