async function giving error
chill-patel opened this issue · 1 comments
chill-patel commented
In async function done keyword is not working
its giving error TypeError: select(...).then(...).done is not a function
`async function select (qry, dbName) {
const config = await someConfig()
let deferred = q.defer()
setTimeout(() => {
deferred.resolve('Some async operation')
}, 1000)
return deferred.promise
}
select()
.then((res) => {
console.log(res)
})
.done()`
with out async function done keyword work fine
benjamingr commented
Async functions always return native promises. You can coerce them to Q promises later on though in all honesty - why?
Native promises are the future, Q is a great readable library that helps us understand how promises work.