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

[Dialog] Typing error when trying to pass component to PaperProps of Dialog #32392

Closed
2 tasks done
jussirantala opened this issue Apr 20, 2022 · 2 comments · Fixed by #35924
Closed
2 tasks done

[Dialog] Typing error when trying to pass component to PaperProps of Dialog #32392

jussirantala opened this issue Apr 20, 2022 · 2 comments · Fixed by #35924
Labels
bug 🐛 Something doesn't work component: dialog This is the name of the generic UI component, not the React module! component: Paper This is the name of the generic UI component, not the React module! typescript

Comments

@jussirantala
Copy link

jussirantala commented Apr 20, 2022

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

You can't set component prop in PaperProps without TS errors even though the prop exists in Paper component.

Expected behavior 🤔

You should be able to set all Paper component props in PaperProps prop of Dialog.

Steps to reproduce 🕹

Steps:

Write the following code and see the TS errors on the latter.

<Paper component={"form"} onSubmit={handleSubmit} />
<Dialog
  PaperProps={{
    component: "form",
    onSubmit: handleSubmit,
  }}
/>

Context 🔦

I am trying to use the Dialog as a form by changing Paper component into form. I cannot just wrap the whole Dialog with form because I have portal enabled for the Dialog.

Your environment 🌎

`tsconfig.json` ``` { "extends": "../tsconfig.base.json", "compilerOptions": { "rootDir": "..", "baseUrl": ".", "composite": false, "declaration": false, "declarationMap": false, "sourceMap": false, } } ```
@jussirantala jussirantala added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Apr 20, 2022
@danilo-leal danilo-leal changed the title Dialog: Typings of PaperProps prop doesn't allow all Paper props [Dialog] Typings of PaperProps prop doesn't allow all Paper props Apr 20, 2022
@danilo-leal danilo-leal added the component: dialog This is the name of the generic UI component, not the React module! label Apr 20, 2022
@jussirantala
Copy link
Author

Maybe related? #27703

@hbjORbj
Copy link
Member

hbjORbj commented Apr 21, 2022

@jussirantala

You are correct. This and #27703 have the same root problem, which is that the interface PaperProps doesn't have component as a key.

I opened a pull request for the fix here: #32404

@hbjORbj hbjORbj added bug 🐛 Something doesn't work component: Paper This is the name of the generic UI component, not the React module! typescript and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Apr 21, 2022
@hbjORbj hbjORbj changed the title [Dialog] Typings of PaperProps prop doesn't allow all Paper props [Dialog] Typing error when trying to pass component to PaperProps of Dialog Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: dialog This is the name of the generic UI component, not the React module! component: Paper This is the name of the generic UI component, not the React module! typescript
Projects
None yet
3 participants