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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FormLabel] Export FormLabelOwnProps from FormLabel to fix type error #36035

Closed
2 tasks done
yoskeoka opened this issue Feb 3, 2023 · 3 comments 路 Fixed by #36057
Closed
2 tasks done

[FormLabel] Export FormLabelOwnProps from FormLabel to fix type error #36035

yoskeoka opened this issue Feb 3, 2023 · 3 comments 路 Fixed by #36057
Labels
bug 馃悰 Something doesn't work component: FormControl The React component good first issue Great for first contributions. Enable to learn the contribution process. regression A bug, but worse typescript

Comments

@yoskeoka
Copy link
Contributor

yoskeoka commented Feb 3, 2023

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 馃暪

Link to live example:

https://codesandbox.io/s/sad-merkle-3swvv2?file=/src/Demo.tsx

Steps:

  1. ts(4023) error on export const DemoLabel = styled(FormLabel)(({ theme }) => ({}));

Current behavior 馃槸

type error happens

Exported variable 'DemoLabel' has or is using name 'FormLabelOwnProps' from external module "/sandbox/node_modules/@mui/material/FormLabel/FormLabel" but cannot be named.ts(4023)

Expected behavior 馃

no type errors

Context 馃敠

This type error stops the build process.
Exporting FormLabelOwnProps on the file node_modules/@mui/material/FormLabel/FormLabel.d.ts fixes this problem.

I think this issue looks like the same as #33165

Your environment 馃寧

npx @mui/envinfo
  It does not depend on any browsers.

  Output from `npx @mui/envinfo` goes here.

  System:
    OS: macOS 13.1
  Binaries:
    Node: 18.9.1 - ~/.asdf/installs/nodejs/18.9.1/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.19.1 - ~/.asdf/plugins/nodejs/shims/npm
  Browsers:
    Chrome: 109.0.5414.119
    Edge: Not Found
    Firefox: Not Found
    Safari: 16.2
  npmPackages:
    @emotion/react:  11.10.5 
    @emotion/styled:  11.10.5 
    @mui/base:  5.0.0-alpha.114 
    @mui/core-downloads-tracker:  5.11.5 
    @mui/envinfo: ^2.0.8 => 2.0.8 
    @mui/icons-material:  5.11.0 
    @mui/material:  5.11.5 
    @mui/private-theming:  5.11.2 
    @mui/styled-engine:  5.11.0 
    @mui/system:  5.11.5 
    @mui/types:  7.2.3 
    @mui/utils:  5.11.2 
    @types/react:  18.0.27 
    react:  18.2.0 
    react-dom:  18.2.0 
    typescript: 4.9.5 => 4.9.5 
@yoskeoka yoskeoka added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Feb 3, 2023
@yoskeoka yoskeoka changed the title export FormLabelOwnProps export FormLabelOwnProps from FormLabel to fix type error Feb 3, 2023
@zannager zannager added the customization: theme Centered around the theming features label Feb 3, 2023
@mj12albert
Copy link
Member

@yoskeoka Thanks for reporting this and finding the fix ~ would you like to create a PR 馃槃

@mj12albert mj12albert added typescript and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer customization: theme Centered around the theming features labels Feb 3, 2023
@ZeeshanTamboli
Copy link
Member

ZeeshanTamboli commented Feb 3, 2023

This issue occurs only for library apps where it is needed to generate declaration files (.d.ts) with declaration: true set in its tsconfig. @yoskeoka Do you build a library where you export declaration files? I had fixed the same for #33165 in PR #33751.

Also, this issue occurs only in the latest version of @mui/material i.e, v5.11.7 because of changes in #35852. These are hard bugs to prevent and catch while reviewing.

As you mentioned, you just need to export FormLabelOwnProps interface.

@ZeeshanTamboli ZeeshanTamboli added bug 馃悰 Something doesn't work good first issue Great for first contributions. Enable to learn the contribution process. component: FormControl The React component regression A bug, but worse labels Feb 3, 2023
@ZeeshanTamboli ZeeshanTamboli changed the title export FormLabelOwnProps from FormLabel to fix type error [FormLabel] Export FormLabelOwnProps from FormLabel to fix type error Feb 3, 2023
@yoskeoka
Copy link
Contributor Author

yoskeoka commented Feb 4, 2023

@mj12albert
Sure. I will try to create a PR to fix this.

@ZeeshanTamboli
Yes, in my case this issue occurred when the declaration flag set true on our monorepo project.
I also think, just exporting FormLabelOwnProps is the good way to fix this issue.

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: FormControl The React component good first issue Great for first contributions. Enable to learn the contribution process. regression A bug, but worse typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants