kysely
kysely copied to clipboard
A way to disable 'preventAwait'
Although @koskimas closed #693 as 'wontfix', I'm suggesting a way to disable the behavior of preventAwait, with a small footprint. We often returning non-Promise value in async function or then() chains. It would be great if Kysely have an option for those situation, for people who aren't Knex-newbie or know how to execute query.
The name 'allowNoopAwait' is a little bit temporary, it can be renamed as 'allowAwait', 'ignoreAwait', 'disablePreventAwait', 'iKnowHowToExecute' or something you suggest.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
kysely | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jan 14, 2024 9:25am |
Hey 👋
We often returning non-Promise value in async function or then() chains. It would be great if Kysely have an option for those situation
I didn't get the necessity quite honestly. Can you elaborate on that?
I didn't get the necessity quite honestly. Can you elaborate on that?
The code from original issue #693, and I'm not sure I can find better example.. Yeah it is not "often" but "rarely", sorry for overstating. But it worth considering turning off the behavior that throwing error without actual logical reason.
But it worth considering turning off the behavior that throwing error without actual logical reason.
There is a logical reason. People coming from knex and objection would make the mistake of awaiting queries without execute
. Kysely is heavily inspired by knex which naturally leads people thinking it behaves the same.
There is a logical reason. People coming from knex and objection would make the mistake of awaiting queries without
execute
. Kysely is heavily inspired by knex which naturally leads people thinking it behaves the same.
@koskimas I didn't denied it. I meant "programming logic error". Anyways, It was a light suggestion, never mind.
I think it wouldn't hurt to add this. But remove the delete clazz.prototype.then
thing. Having a simple then
method that simply values through when prevent = false
shouldn't have any measurable effect on performance.
Edit: Or actually, will that cause infinite recursion? Does resolve
call .then
?
@koskimas Yes. That was the reason I have to delete then
.