Skip to content

TypeScript in-source docstring pagination examples fail the repo's strict typecheck #511

Description

@jeremy

All references are to origin/main = d5611fde. Companion to the README fix in #507 — same defect, but in source, so out of a README-only PR.

The docstring examples for the pagination helpers use bare r.json() callbacks:

  • typescript/src/client.ts:1166-1168 (fetchAllPages)
  • typescript/src/client.ts:1211 (paginateAll)

The parse-callback parameter type is (response: Response) => Promise<T[]> (client.ts:1173, :1218), and under the repo's own strict/NodeNext config with Node fetch types, Response.json() is Promise<unknown> — so a user copying the docstring example into a project configured like this repo gets a type error. Proven while preparing #507: the README's identical example failed tsc --noEmit until the callback was written as (r) => r.json() as Promise<any[]>.

The docstrings only typecheck under DOM lib (Body.json(): Promise<any>), which is why they've survived — the SDK's own typecheck doesn't compile docstring fences.

Fix: mirror #507's README form ((r) => r.json() as Promise<any[]>) in both docstrings, or type the examples' callbacks explicitly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationtypescriptPull requests that update TypeScript code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions