react-toastify-redux icon indicating copy to clipboard operation
react-toastify-redux copied to clipboard

Fix "TS2304: Cannot find name 'ToastType'." error in TS definitions + make message optional when updating

Open benhodgson87 opened this issue 6 years ago • 1 comments

screen shot 2018-11-13 at 11 27 26

The current Typescript definitions throw a TS2304 error, because the ToastType import being used here (imported from the react-toastify package) is an interface, not a type definition - https://github.com/fkhadra/react-toastify/blob/master/index.d.ts#L299.

The type definition that needs to be matched against is actually TypeOptions - https://github.com/fkhadra/react-toastify/blob/master/index.d.ts#L70 - however this is not exported.

Seeing as a load of other types are being manually defined in the react-toastify-redux definitions file (eg. pauseOnHover, hideProgressBar) I think it makes sense to just manually define the types locally, until the core package exports the necessary types.

I've also changed the message option to be optional on the update() method definition; it's not required in the core package, as you may only want to update another option such as type.

benhodgson87 avatar Nov 13 '18 12:11 benhodgson87

Pull Request Test Coverage Report for Build 15

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 14: 0.0%
Covered Lines: 65
Relevant Lines: 65

💛 - Coveralls

coveralls avatar Nov 13 '18 12:11 coveralls