eBay / nice-modal-react

A modal state manager for React.
https://ebay.github.io/nice-modal-react
MIT License
1.96k stars 110 forks source link

Better way to provide type of modal props in TypeScript #67

Closed nik32 closed 1 year ago

nik32 commented 2 years ago

At the moment if I have to provide type of modal props (while calling NiceModal.show()), then I do something like the below -

image

It would be nice if I wouldn't have to declare a separate variable - just so that TS helps me to provide correct props to the modal (when this can be done without declaring the variable). Implementing this suggestions would help in readability and save a LOC and variable. One suggestion from me is something like this -

image

Right now, trying to do the above, provides the 'DeleteModalProps' type to the returned promise's value (not to the props of modal).