You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
typeProps={onSubmit: ()=>void;name: string;};
Then:
importNiceModalfrom'@ebay/nice-modal-react';importMyModalfrom'./components/MyModal';constApp=()=>{constonClick=()=>NiceModal.show(MyModal,{something: '123',// No error, even though `MyModal` doesn't have a `something` propname: '456',});// No error, even though prop `onSubmit` hasn't been providedreturn<buttononClick={onClick}>Show modal</button>;};
It would be nice to have errors when the provided object doesn't match the type of the modal props 🙂
The text was updated successfully, but these errors were encountered:
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?
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 🙂
The text was updated successfully, but these errors were encountered: