-
-
Notifications
You must be signed in to change notification settings - Fork 264
Open
Labels
bug 🔥Something isn't workingSomething isn't workingclientClient package relatedClient package relatedjavascriptPull requests that update Javascript codePull requests that update Javascript code
Description
Description
@hey-api/openapi-ts v0.86.11
"@hey-api/client-fetch": "^0.13.1"
"typescript": "~5.9.3"
I wanted to create a quick pagination script that grabs the cursor from the result and uses it in the query parameters again, but this seems to break the typings alltogether:
Diagnostics:
1. 'res' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. [7022]
import { listDevices } from "./lib/api";
import { createClient } from "./lib/api/client";
const client = createClient({})
let cursor: string | undefined = undefined;
do {
const { data, error } = await listDevices({
client,
query: {
cursor,
}
})
if (!data && error) throw new Error("Borken: ", error)
if (data?.links?.next) cursor = URL.parse(data.links.next)?.searchParams.get("cursor") || undefined;
} while (cursor);openapi-ts -i ./api.yaml -o src/lib/api -c @hey-api/client-fetch
Reproducible example or configuration
No response
OpenAPI specification (optional)
openapi: 3.0.0
info:
title: Example API
version: '0.0.1'
servers:
- description: Production
url: 'https://sensorbucket.nl/api'
- description: Localhost
url: 'http://localhost:3000/api'
paths:
/devices:
get:
operationId: ListDevices
summary: List devices
description: |
Fetch a list of devices.
tags: ["Core"]
parameters:
- in: query
name: cursor
description: The cursor for the current page
required: false
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
actualData:
type: object
links:
type: object
properties:
next:
type: stringSystem information (optional)
No response
Copilot
Metadata
Metadata
Assignees
Labels
bug 🔥Something isn't workingSomething isn't workingclientClient package relatedClient package relatedjavascriptPull requests that update Javascript codePull requests that update Javascript code