Nx 모노레포에서 Emotion을 사용할 때의 union type that is too complex 문제
TS2590: Expression produces a union type that is too complex to represent.
Nx를 사용한 모노레포에서 @nrwl/react:lib
generator를 통해 라이브러리를 생성했는데, 갑자기 JSX를 사용하려고 하니 문제가 발생한다.
해결
생성된 라이브러리의 tsconfig.json
에서 jsxImportSource
항목을 제거하면 오류가 사라진다.
{
"compilerOptions": {
"jsx": "react-jsx",
"allowJs": false,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
}
],
"extends": "../../../../tsconfig.base.json"
}