Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
415 views
in Technique[技术] by (71.8m points)

typescript - Cannot import TransitionProps from latest MUI version

I'm using material ui "@material-ui/core": "^4.11.3", I want to import typescript inderface TransitionProps, but the eslint says the path cannot be resolved. I have the same code like in the material ui sandbox. Only difference the sandbox is using "latest" and I have version "^4.11.3", which is the latest. What is wrong?

eslint error

Unable to resolve path to module '@material-ui/core/transitions'.eslintimport/no-unresolved
question from:https://stackoverflow.com/questions/65920128/cannot-import-transitionprops-from-latest-mui-version

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I'm using @material-ui/core version 4.11.3 and I'm not seeing that error with TransitionProps imports. When stuff like this happens I usually go through these steps, stopping after each to see if it resolved the issue:

  • Verify you spelled everything correctly (this is a good case for using copy/paste and copying the import from that working codesandbox)
  • Restart the TypeScript server (in VSCode with a .ts or .tsx file open in the editor: Shift + Cmd + P, "Typescript: Restart TS server")
  • Clean
    • Delete node_modules and and any build directories (ex: if using NextJS, delete the .next folder, if Gatsby delete .cache folder, etc)
    • Run yarn or npm install

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...