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

createSvgIcon type definitions are not packaged #14517

Closed
2 tasks done
mgansler opened this issue Feb 13, 2019 · 5 comments
Closed
2 tasks done

createSvgIcon type definitions are not packaged #14517

mgansler opened this issue Feb 13, 2019 · 5 comments
Labels
package: icons Specific to @mui/icons typescript

Comments

@mgansler
Copy link
Contributor

This is a follow up to #13974

  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior 🤔

I should be able to use createSvgIcon in tsx files.

Current Behavior 😯

It is not possible to use the type definitions are not in the package

Steps to Reproduce 🕹

  1. Create a *.tsx file
  2. Add this line: import createSvgIcon from "@material-ui/icons/utils/createSvgIcon"
  3. Get hit in the face by typescript error TS7016 ;-)

Your Environment 🌎

Tech Version
Material-UI v3.9.1
React v16.6.3
TypeScript v3.1.6
@mgansler
Copy link
Contributor Author

mgansler commented Feb 13, 2019

Created PR: #14518

@oliviertassinari
Copy link
Member

oliviertassinari commented Feb 13, 2019

@eps1lon
Copy link
Member

eps1lon commented Feb 13, 2019

@mgansler I recommend you patch those declarations locally.

declare module "@material-ui/icons/utils/createSvgIcon" {
  import SvgIcon from '@material-ui/core/SvgIcon';

  declare function createSvgIcon(path: React.ComponentType, displayName: string): typeof SvgIcon;

  export default createSvgIcon;
}

We already fixed this for @material-ui/icons@next.

@eps1lon eps1lon added typescript package: icons Specific to @mui/icons labels Feb 13, 2019
@oliviertassinari
Copy link
Member

@mgansler Let us know if you can reproduce the problem with @material-ui/icons@next. I'm closing for now.

@mgansler
Copy link
Contributor Author

Sorry for the long delay, @next works just fine, but I will use a local declaration until 4.0.0 is released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: icons Specific to @mui/icons typescript
Projects
None yet
Development

No branches or pull requests

3 participants