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

Typescript typings wrong for copyObject operation #1097

Open
phal0r opened this issue Jan 19, 2023 · 3 comments
Open

Typescript typings wrong for copyObject operation #1097

phal0r opened this issue Jan 19, 2023 · 3 comments

Comments

@phal0r
Copy link

phal0r commented Jan 19, 2023

Given the latest releases:

"minio": "^7.0.32",
"@types/minio": "^7.0.15"

Typings are wrong for copyObject. The overloads for optional CopyConditions are missing. Passing null also leads to the error, although optional CopyConditions or passing null is allowed and supported in the source.

@6XGate
Copy link

6XGate commented May 8, 2023

There are many issues with the typings. Another is the BucketItem type is defined such that it would seem all members are present, which isn't the case. Prefix-only entries only have prefix and size where as object entries has name, lastModified, etag, and size.

It also requires the access and secret key for the client, which are actually optional.

I'm sure there are other issues.

@aldy505
Copy link
Contributor

aldy505 commented May 29, 2023

@phal0r Since we've migrated @types/minio to this repo, can you please take a look at:

minio-js/src/minio.d.ts

Lines 404 to 416 in 23ad6e2

copyObject(
bucketName: string,
objectName: string,
sourceObject: string,
conditions: CopyConditions,
callback: ResultCallback<BucketItemCopy>,
): void
copyObject(
bucketName: string,
objectName: string,
sourceObject: string,
conditions: CopyConditions,
): Promise<BucketItemCopy>

and confirm whether that is correct?

p.s. me and @trim21 are not minio employee

@trim21
Copy link
Contributor

trim21 commented May 29, 2023

@phal0r Since we've migrated @types/minio to this repo, can you please take a look at:

minio-js/src/minio.d.ts

Lines 404 to 416 in 23ad6e2

copyObject(
bucketName: string,
objectName: string,
sourceObject: string,
conditions: CopyConditions,
callback: ResultCallback<BucketItemCopy>,
): void
copyObject(
bucketName: string,
objectName: string,
sourceObject: string,
conditions: CopyConditions,
): Promise<BucketItemCopy>

and confirm whether that is correct?

p.s. me and @trim21 are not minio employee

it's still wrong ( or maybe "incomplete" ), I didn't fixed this when importing minio.d.ts.

missing overloads:

 copyObject( 
   bucketName: string, 
   objectName: string, 
   sourceObject: string, 
   callback: ResultCallback<BucketItemCopy>, 
 ): void 

 copyObject( 
   bucketName: string, 
   objectName: string, 
   sourceObject: string, 
   conditions?: CopyConditions, 
 ): Promise<BucketItemCopy> 

(we realy should consider dropping callback API)

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

No branches or pull requests

4 participants