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

Generic type error on `NiceModal.create` #46

Closed SevenOutman closed 2 years ago

SevenOutman commented 2 years ago

Hi, thanks for this great tool! I'm having little trouble with NiceModal.create method when it always require my component props to have an extra [key: string]: unknown property signature.

Here's my modal component with normal prop declaration but fail because of incompatibility with Record<string, unknown>.

image

I always have to add this extra [key: string]: unknown property to dismiss the ts error.

image
john-pimq commented 2 years ago

I have the same problem

gnsharma-pepper commented 2 years ago

Using type instead of interface will solve this. Maybe i can try to send a pr to fix this at the typescript level.

supnate commented 2 years ago

Thanks @gnsharma-pepper , PR is welcome!

gnsharma commented 2 years ago

@supnate created a pr for this.

supnate commented 2 years ago

Thanks @gnsharma for the fix and providing the context why it happens. Published by v1.2.5 .