Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

D1PreparedStatement.all's return type is wrong? #279

Closed
sizumita opened this issue Sep 9, 2022 · 3 comments
Closed

D1PreparedStatement.all's return type is wrong? #279

sizumita opened this issue Sep 9, 2022 · 3 comments

Comments

@sizumita
Copy link

sizumita commented Sep 9, 2022

https://github.com/cloudflare/workers-types/blob/master/src/workers.json#L1712-L1721
It's return type is Promise<D1Result<T[]>>.
I expect that D1Result<T[]>.results returns T[][] but actually it returns T[].

So, I think D1PreparedStatement.all's return type should be Promise<D1Result<T>>.

@probablykasper
Copy link

probablykasper commented Sep 18, 2022

The docs also say that errors are thrown and never mention the error property. So I wonder if the error property can actually exist, and consequently if results is optional.

D1PreparedStatement.run() also has a results? property, even though the docs say that .run() returns no results (same goes for exec I think)

@mrbbot
Copy link
Contributor

mrbbot commented Oct 6, 2022

Fixed by #285.

@mrbbot mrbbot closed this as completed Oct 6, 2022
@probablykasper
Copy link

Opened #289 for the other issues I mentioned

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

No branches or pull requests

3 participants