Fix incorrect types for <GiftedChat />
component
#2576
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please check this PR carefully. I'm not 100% sure about it because I don't fully understand the original typing logic that was there before (I think the old logic was wrong from the start).
My research started with trying to understand why the
renderFooter
prop in the<GiftedChat />
component gives me a typescript error if I try to use an argument from therenderFooter
function. I found it weird that we extend theGiftedChatProps
interface from theMessageContainer
class and not from theMessageContainerProps
interface. This is a problem why Typescript told me that this function had no arguments, although the function itself returned props (this function refers to theMessageContainer
class, not theMessageContainerProps
interface).And in the end I noticed this pull request. There are several users discussing this issue.
I think my PR will fix all the major typing issues. But I don't understand why no one noticed this elephant in the code before me.