Skip to content

Conversation

@damianstasik
Copy link

This PR simplifies specifying type of the resolved value from the show function. Currently, if you want to provide a precise type of the value resolved from a promise, you'll need to provide 1/2 additional types – depending on whether you use an ID or a modal reference.

Before:

NiceModal.show<TypeOfTheValue, ComponentType, PropsType>(SomeModal, someProps).then((value) => { ... });

Both ComponentType and PropsType can be automatically inferred by TS, so having to type them all each time you want to provide TypeOfTheValue is a bit inconvenient.

After:

NiceModal.show<TypeOfTheValue>(SomeModal, someProps).then((value) => { ... });

Now you can provide just the first type while the rest gets inferred. Let me know what you think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant