fkhadra / react-toastify

React notification made easy 🚀 !
https://fkhadra.github.io/react-toastify/introduction
MIT License
12.72k stars 700 forks source link

Typescript issue - commonOptions and transition type not accepting P props #458

Closed ayoungh closed 4 years ago

ayoungh commented 4 years ago

Do you want to request a feature or report a bug? bug

What is the current behavior? I am trying to use transition prop on the container and am getting a type issue because of the: transition?: React.ComponentType; Not taking in

;

This is the typescript error I am getting: JSX.Element' is not assignable to type 'ComponentClass<{}, any> | FunctionComponent<{}> | undefined'.

I have fixed it by hardcoding the types file to have: interface CommonOptions<P> { and transition?: React.ComponentType;<P>

Do you know if this kind of issue will be fixed in V6?

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? "react": "16.13.1", "react-dom": "16.13.1", "@types/react": "16.9.34", "@types/react-dom": "16.9.6",

fkhadra commented 4 years ago

Hey @ayoungh,

In v6 the type for Transition is React.ReactNode can you check if it works for you ?

ayoungh commented 4 years ago

Sorry @fkhadra I am fairly new to typescript, is V6 out now?

I have now used the code from the example to get the transition working but have the type issue. Thanks for your help

fkhadra commented 4 years ago

Hey you can try it there if you want