react-native-gifted-chat icon indicating copy to clipboard operation
react-native-gifted-chat copied to clipboard

GiftedChatProps does not use GiftedChat TMessage generic type parameter

Open tedgoodley opened this issue 2 years ago • 2 comments

Issue Description

GiftedChatProps does not use GiftedChat TMessage generic type parameter. Without this, types that extend IMessage will have type mismatch errors when used as props; e.g. Type 'MyMessage | undefined' is not assignable to type 'Message | undefined'.

Steps to Reproduce / Code Snippets

This line: https://github.com/FaridSafi/react-native-gifted-chat/blob/ba06287912151dbfb71951893d0454db8aafd5a5/src/GiftedChat.tsx#L55C38-L55C38

This seems to be a bug since GiftedChatProps has its own TMessage type parameter which is passed to other prop types.

Expected Results

GiftedChatProps should use TMessage as a type param: declare function GiftedChat<TMessage extends IMessage = IMessage>(props: GiftedChatProps<TMessage>): JSX.Element;

Additional Information

  • react-native-gifted-chat version: 2.4.0

tedgoodley avatar Nov 30 '23 00:11 tedgoodley

I added a PR to fix the problem with types: https://github.com/FaridSafi/react-native-gifted-chat/pull/2576

danilvalov avatar Feb 20 '25 16:02 danilvalov

I think this is no longer relevant. Fixed in my PR already, merged: https://github.com/FaridSafi/react-native-gifted-chat/pull/2576

danilvalov avatar Mar 15 '25 10:03 danilvalov

Should be fixed in master

kesha-antonov avatar Nov 19 '25 20:11 kesha-antonov