Re: [w3c/IndexedDB] Add descending order for getAll() and getAllKeys() (#130)

phaux left a comment (w3c/IndexedDB#130)

> have you experienced any issues?

TypeScript gives worse suggestions and error messages when the argument is `queryOrOptions: string | number | Array | IDBKeyRange | IDBGetAllOptions`.

If it was `countOrOptions: number | IDBGetAllOptions` then it won't suggest unrelated properties from other objects, it will suggest to fix typos in property names and when the type is wrong it will mention that it's not assignable to `Options`.

[Playground](https://www.typescriptlang.org/play/?#code/JYOwLgpgTgZghgYwgAgJIBEBCBxCYCCANoQPIAOYwA9iAM7IDeAUMsgI4Cu0AngPwBcaLADU4hYABMA0hG7IAPkMwzuAJTggA5hBbIEVDuAHIQHALYAjaLonAoEBJRrGMmAMIcotKlHR2HTiBMAL5MTDCGjtQgyNoExMIATAAUumAAFsC0gq4kFgBWAQDKYD4QADS6nDwkUOSBtC4iYpIqCkoq6looiq648aQU0bSVrPqGYMamltYAlDlYqhDVtGAAPIYA1iBUAO4gANoAugB8jLr2YJ4xGVkAdHFEhMnVUNy19cPIcPQa3OV6AzgWYhMIREBRGixPBPYQAZlSrFu2SUeUKjhKZVG7C4byamFE4mksnark6Gm02PG4A+QxojQWOBhxE+9Pa0ysUCY8yUSxW6y2O32xzOzFYl2uyGRD2Zz1e-0BE1pDW+vxA3BBoSYEgchDg9kBdDAyFWZUZaOKpXsYUeCUSdwQYmepvsAIYyFsUCokJAggARKYAB5gP3IYIgpi2wjwh1O5IuirIP2bWR+t0ezwBaL+shQYAAN1D4aAA)

> provides consistency between APIs

`getAllRecords` could also take options as the second parameter:

```ts
interface IDBGetAllOptions {
  count?: number
  direction?: IDBCursorDirection
}

interface IDBObjectStore {
  getAll(query?: IDBValidKey | IDBKeyRange, countOrOptions?: number | IDBGetAllOptions)
  getAllRecords(query?: IDBValidKey | IDBKeyRange, options?: IDBGetAllOptions)
}
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/IndexedDB/issues/130#issuecomment-3324017212
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/IndexedDB/issues/130/3324017212@github.com>

Received on Tuesday, 23 September 2025 13:26:23 UTC