Closed
Description
Package version
@adonisjs/[email protected]
Describe the bug
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
Reproduction repo
https://github.com/shiny/reproduce-thenable-class-issue/blob/main/tests/unit/example.spec.ts