We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@adonisjs/fold@10.0.1
This is a simple Thenable Class Example
class Database { where() { return this } and() { return this } limit() { return this } then(onFulfilled: (result: string) => any) { onFulfilled('my example result') } }
What I expect is
const db = await app.container.make(Database) const result = await db.where().and().limit() result === 'my example result''
But the result is db === 'my example result', not a instance of Database. The thenable class is useful for graceful chain methods
db === 'my example result'
Database
https://github.com/shiny/reproduce-thenable-class-issue/blob/main/tests/unit/example.spec.ts
The text was updated successfully, but these errors were encountered:
That's expected because that's how await works under the hood. It will resolve all the promises.
await
I am not sure there any simple way to work around this. Lemme know if you have anything in mind.
Sorry, something went wrong.
Oh I get it now, thank you for your patience to help.
thetutlage
No branches or pull requests
Package version
@adonisjs/fold@10.0.1
Describe the bug
This is a simple Thenable Class Example
What I expect is
But the result is
db === 'my example result'
, not a instance ofDatabase
.The thenable class is useful for graceful chain methods
Reproduction repo
https://github.com/shiny/reproduce-thenable-class-issue/blob/main/tests/unit/example.spec.ts
The text was updated successfully, but these errors were encountered: