Skip to content

Infer modal props type for useModal#10

Open
lukasluecke wants to merge 1 commit into
maxchehab:masterfrom
lukasluecke:patch-1
Open

Infer modal props type for useModal#10
lukasluecke wants to merge 1 commit into
maxchehab:masterfrom
lukasluecke:patch-1

Conversation

@lukasluecke

Copy link
Copy Markdown

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

maxchehab commented Apr 18, 2020

Copy link
Copy Markdown
Owner

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
Copy Markdown
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