react-alert icon indicating copy to clipboard operation
react-alert copied to clipboard

Custom alert type with typescript

Open yerlantemir opened this issue 3 years ago • 1 comments

How to repeat example from #121 with typescript ? I am facing error:

TS2345: Argument of type '{ CUSTOM_TYPE: string; }' is not assignable to parameter of type 'AlertCustomOptionsWithType'.

yerlantemir avatar May 12 '21 04:05 yerlantemir

I came up on creating my custom useAlert hook with showAlert method which similarly takes message and type as arguments. And if type === Warning, I add '_' to my message and call alert.show method from library image

And in my AlertTemplate I do this: image

Where: image

I know that it's kinda weird solution, but it works ! :)

yerlantemir avatar May 12 '21 09:05 yerlantemir