Open gprst opened 8 months ago
If it isn't to automatically generate the type, we should probably be able to pass it as a simple generic parameter right?
If it isn't to automatically generate the type, we should probably be able to pass it as a simple generic parameter right?
I wonder if we could get around this by simply overriding the NiceModal.show()
function. I haven't used the library yet (I'm just considering it), however I imagine we should be able to do something like this?
const originalShow = NiceModal.show
NiceModal.show = <T>(modal: T, props: React.ComponentProps<T>, ...args) => originalShow(modal, props, ...args)
It seems not to be possible to call
NiceModal.show
with a strong typing of the called modal props.Let's say that
MyModal
has the following props:Then:
It would be nice to have errors when the provided object doesn't match the type of the modal props 🙂