cloudflare / cloudflare/workerd
SqlStorageCursor.next type is not OK
- Dominant language
- C++
- Stars
- 8.7k
- Forks
- 739
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 174
Description
https://github.com/cloudflare/workerd/blob/d7e9c38f6af8b6587ab23fd9c4635af522273ff1/src/workerd/api/sql.h#L212
### Description
In this piece of code
```typescript
let cursor = this.sql.exec(`SELECT seatId, occupant FROM seats`);
// Cursors are iterable.
let results = Iterator.from(cursor).map((row) => {
// Each row is an object with a property for each column.
return { seatNumber: row.seatId, occupant: row.occupant };
}).toArray();
```
`row` from map shows to may be undefined, but it shouldn't be
### My solution
replace
```typescript
next(): { done?: false, value: T } | { done: true, value?: never };
```
with
```typescript
next(): IteratorResult;
```
Contributor guide
Assessment
This issue has not been assessed yet.