-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Description
Confirm this is a Typescript library issue and not an underlying Cloudflare API issue
- This is an issue with the Typescript library
Describe the bug
client.browserRendering.scrape.create()
returns an array of ScrapeCreateResponseItem
.
Each object in this array has a results
property, and its type is correctly defined.
However, the actual type of the results
property, Results
, is defined as a single object instead of an array.
To Reproduce
.
Code snippets
const scrapes = await client.browserRendering.scrape.create({
account_id: CLOUDFLARE_ACCOUNT_ID,
allowResourceTypes: ['document'],
elements: [{ selector }],
url: targetUrl,
})
console.log(scrapes[0]?.results) // returns an array of `Results`
console.log(scrapes[0]?.results[0]?.text) // Outputs the correct value but shows a type error.
console.log(scrapes[0]?.results.text) // No type error occurs but outputs undefined.
OS
WSL Ubuntu 24.04
Runtime version
Bun v1.2.18
Library version
v4.4.1
Metadata
Metadata
Assignees
Labels
No labels