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

Incorrect return type for TypedClient.getBucketVersioning() #1296

Closed
SleepyLeslie opened this issue May 22, 2024 · 3 comments · Fixed by #1297
Closed

Incorrect return type for TypedClient.getBucketVersioning() #1296

SleepyLeslie opened this issue May 22, 2024 · 3 comments · Fixed by #1297

Comments

@SleepyLeslie
Copy link

The function here definitely returns something, so its return type shouldn't be Promise<void>.

async getBucketVersioning(bucketName: string): Promise<void> {

Here is my suggestion. I didn't look very closely so I might have missed some fields.

type VersioningStatus = {
  "Status": "Enabled" | "Suspended",
  "ExcludeFolders": boolean,
  "ExcludedPrefixes": {"Prefix": string}[]
}

getBucketVersioning(bucketName: string): Promise<"" | VersioningStatus>;

Note that it currently returns an empty string when versioning has never been toggled on. It might be a good idea to return {Status: "Disabled"} instead.

@prakashsvmx
Copy link
Member

Yes. We will update it. Thank you for the feedback.

@SleepyLeslie
Copy link
Author

SleepyLeslie commented May 28, 2024

Thanks @prakashsvmx for the fix. But the new typing still doesn't address the possible return value '' when versioning has never been enabled. Will that be fixed?

@fflorent
Copy link
Contributor

fflorent commented Jun 5, 2024

Thanks @prakashsvmx for the fix. But the new typing still doesn't address the possible return value '' when versioning has never been enabled. Will that be fixed?

Opened #1303 to track your question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants