React/Material-UI
[MUI] Expression produces a union type that is too complex to represent 에러 해결
개형이
2024. 1. 4. 12:19
프로젝트를 빌드하려고 했더니 계속해서 에러가 발생하는 고충을 겪는 중이다.
그 중,
"Expression produces a union type that is too complex to represent" 에러가 발생하며
vs code에서 mui의 Box에 에러를 표시했다.
그래서 "Expression produces a union type that is too complex to represent"를 서치하여
1. > typescript: Select Typescript Version 옵션에서 Use Workspace Version
2. tsdk에 node_modules/typescript/lib 명시
위 옵션을 vscode에 적용했지만, 문제는 해결되지 않았다. 씁!
문제를 해결하기 위해 Box에 component 태그를 명시하여 타입스크립트의 에러를 피할 수 있었다.
<Box component="div">
위 component props는 root node로 사용할 HTML element라고 보면 된다.