Skip to content

Incorrect return type for TypedClient.getBucketVersioning() #1296

@SleepyLeslie

Description

@SleepyLeslie

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions