Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async function giving error #837

Closed
chill-patel opened this issue Sep 3, 2018 · 1 comment
Closed

async function giving error #837

chill-patel opened this issue Sep 3, 2018 · 1 comment

Comments

@chill-patel
Copy link

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
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants