minio-js
minio-js copied to clipboard
Docs: missing types for listObjectsV2
According to the API docs for listObjectsV2 obj.name and obj.etag are string and obj.lastModified is Date. Based on BucketItem type in the code and the following observed error from tsc, it seems they can also be undefined or never:
error TS2345: Argument of type 'BucketItem' is not assignable to parameter of type '{ name: string; }'. Type '{ name?: undefined; etag?: undefined; lastModified?: undefined; prefix: string; size: 0; }' is not assignable to type '{ name: string; }'. Types of property 'name' are incompatible. Type 'undefined' is not assignable to type 'string'.
- Does this pose any risk during runtime?
- Is it safe to use the types like
BucketItemfromsrc/internal/type.ts? - Maybe the documentation could be updated to reflect something about this?
@timglorioso , thank you,
Is it safe to use the types like BucketItem from src/internal/type.ts?
yes. since refactoring to ts is in progress, it is named that way. feel free to contribute with changes/PR for docs or code.