Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infer modal props type for useModal #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lukasluecke
Copy link

I think it might also make sense to change the default <p = any> usages, so you actually have to specify the prop types? But for now this works as it is, so at least you don't need to specify the types twice 🙂

@maxchehab
Copy link
Owner

maxchehab commented Apr 18, 2020

I think this is a really nice idea. Would you mind fixing the build errors? A couple places in the reconciler I am passing a dummy function as useModal so it doesn't get invoked.

Here is an example:

phelia/src/core/phelia.ts

Lines 514 to 516 in 3cb0344

function useModal(): (title: string, props?: any) => Promise<void> {
return async () => null;
}

I think it would be fine to export the useModal type and cast these functions like:

    const useModal = (() => null) as UseModal;

@lukasluecke
Copy link
Author

Sure, I'll look into it a bit more 🙂

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.

2 participants