MessageInputContext uploadNewImage types are wrong
The TypeScript signature for MessageInputContext uploadNewImage has changed, and is now more awkward for developers to use.
It was previously uploadNewImage: (image: Partial<Asset>) => Promise<void>.
It is now uploadNewImage: (image: Asset) => Promise<void>.
In stream-chat-expo 4.3.1 then we could do:
uploadNewImage({
uri: result.uri, // e.g. a file:/// URL of an image from the gallery
});
However from stream-chat-expo 4.6.0, the TypeScript requires us to provide a full Asset, not just Partial<Asset>.
export declare type Asset = {
duration: number | null;
filename: string;
fileSize: string;
height: number;
playableDuration: number | null;
source: 'camera' | 'picker';
type: string;
uri: string;
width: number;
id?: string;
size?: number | string;
};
But from my testing, the API behaves as before, and I can continue to provide just uri. If this is the case, it would be good for the TypeScript signature to reflect this.
The only issue I have found with the above is that I have seen intermittent warnings such as
Failed to get size for image: https://dublin.stream-io-cdn.com/1179380/images/2832d372-7667-4e2a-a614-6ab06f8eebcc.4144fd27-9ae1-46ec-a707-5c63ca8c372d.jpg?Key-Pair-Id=.... but this doesn't appear to prevent the functionality working.
I also note that the Stream Javascript API doesn't require any extra metadata, so it would be surprising for the uploadNewImage method to require it.
@khushal87 @vishalnarkhede can you take a look at this? What's the reason of changing the types? We are having the same issue.
Hey team! Please add your planning poker estimate with ZenHub @khushal87 @madsroskar @vishalnarkhede
:tada: This issue has been resolved in version 5.4.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket: