Skip to content

Commit

Permalink
Fix tsc type validation (minio#1106)
Browse files Browse the repository at this point in the history
  • Loading branch information
Florent FAYOLLE authored and fflorent committed Jul 18, 2023
1 parent b80f253 commit 4819400
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
22 changes: 13 additions & 9 deletions src/internal/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,20 @@ export interface BucketItemCopy {
lastModified?: Date
}

export interface BucketItem {
name: string
prefix: string
size: number
etag: string
lastModified: Date
}
export type BucketItem =
| {
name: string
size: number
etag: string
lastModified: Date
}
| {
prefix: string
size: 0
}

export interface BucketItemWithMetadata extends BucketItem {
metadata: ItemBucketMetadata | ItemBucketMetadataList
export type BucketItemWithMetadata = BucketItem & {
metadata?: ItemBucketMetadata | ItemBucketMetadataList
}

export type StatObjectOpts = {
Expand Down
5 changes: 3 additions & 2 deletions src/internal/xml-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { XMLParser } from 'fast-xml-parser'
import * as errors from '../errors.ts'
import { parseXml, sanitizeETag, sanitizeObjectKey, toArray } from './helper.ts'
import { readAsString } from './response.ts'
import type { BucketItemFromList, BucketItemWithMetadata } from './type.ts'
import type { BucketItemWithMetadata } from './type'
import type { BucketItemFromList } from './type.ts'

// parse XML response for bucket region
export function parseBucketRegion(xml: string): string {
Expand Down Expand Up @@ -92,7 +93,7 @@ export async function parseResponseError(response: http.IncomingMessage) {
*/
export function parseListObjectsV2WithMetadata(xml: string) {
const result: {
objects: Array<BucketItemWithMetadata>
objects: BucketItemWithMetadata[]
isTruncated: boolean
nextContinuationToken: string
} = {
Expand Down

0 comments on commit 4819400

Please sign in to comment.