Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing include property from R2ListOptions #1522

Closed
gnosticdev opened this issue Jan 8, 2024 · 3 comments
Closed

Missing include property from R2ListOptions #1522

gnosticdev opened this issue Jan 8, 2024 · 3 comments
Assignees
Labels
types Related to @cloudflare/workers-types

Comments

@gnosticdev
Copy link

Per the API Reference:

R2ListOptions has an include property that accepts httpMetadata and/or customMetadata. If included, items returned by the list will include the specified metadata.

This property is not included in the typescript definitions:

declare interface R2ListOptions {
  limit?: number;
  prefix?: string;
  cursor?: string;
  delimiter?: string;
  startAfter?: string;
//include?: Array<string> <-- missing
}
@gnosticdev gnosticdev added the types Related to @cloudflare/workers-types label Jan 8, 2024
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Jan 8, 2024
@gnosticdev gnosticdev changed the title Missing include property from R2ObjectListOptions Missing include property from R2ListOptions Jan 8, 2024
@KianNH
Copy link
Contributor

KianNH commented Jan 9, 2024

The @cloudflare/workers-types package has several folders which contain the correct types for different compatibility dates. If you don't specify one of those, you will default to the oldest types.

You need to be on (at least) the 2022-08-04 types for the include property, since it wasn't respected up until that compatibility date when it was fixed via the r2_list_honor_include flag.

Replace @cloudflare/workers-types in tsconfig.json with the appropriate set, i.e @cloudflare/workers-types/2023-07-01 if your compatibility date is on or after 2023-07-01.

@gnosticdev
Copy link
Author

gnosticdev commented Jan 9, 2024 via email

@mrbbot
Copy link
Contributor

mrbbot commented Jan 15, 2024

Looks like this has been resolved. We're working on a new types generation system that should make these kind of issues harder to come by. 👍

@mrbbot mrbbot closed this as completed Jan 15, 2024
@github-project-automation github-project-automation bot moved this from Untriaged to Done in workers-sdk Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types Related to @cloudflare/workers-types
Projects
None yet
Development

No branches or pull requests

4 participants