TypeScript: Expression produces a union type that is too complex to represent. ts(2590)
See original GitHub issueπ Bug report
in some cases, instead of updating the theme, we want to change some defaults in components directly, to fit a more opinionated approach, and proxy ChakraUI components β¦ f.ex:
import { ModalBody as ModalBodyComponent, ModalBodyProps } from '@chakra-ui/modal';
import { forwardRef } from '@chakra-ui/system';
import * as React from 'react';
export const ModalBody = forwardRef<ModalBodyProps, 'div'>((props, ref) => {
return <ModalBodyComponent pb={6} {...props} ref={ref} />;
});
π₯ Steps to reproduce
components with a lot of props (number unknown) seem to be the culprit
π» Link to reproduction
Note, I cannot seem to reproduce this on Codesandbox, but I can reproduce this locally in a clean project, So i suggest cloing the codesandbox locally. CodeSandbox reproduction: https://codesandbox.io/s/summer-night-bmzsl?file=/src/ModalBody.tsx
π§ Expected behavior
union types should not be extra complex using this method
π§ Possible Solution
n/a
π System information
Software | Version(s) |
---|---|
Chakra UI | β@chakra-ui/modalβ: β1.7.0β, β@chakra-ui/systemβ: β1.4.0β, β@chakra-ui/utilsβ: β1.4.0β, |
Browser | n/a |
Operating System | MacOS |
π Additional information
could be related to #3706
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Expression produces a union type that is too complex ... - GitHub
src/template-language-service-decorator.ts:44:13 - error TS2590: Expression produces a union type that is too complex to represent.
Read more >TS Expression produces a union type that is too complex to ...
Solution 1. The stable version of MaterialUI fix this problem. Use this package: npm install @mui/material. Solution 2 by Vivere.
Read more >ts2590: expression produces a union type that is too complex ...
1 Typescript Box produces a union type that is too complex to represent. Rendering a Box produces the following error: Expression produces a...
Read more >typescript expression produces a union type that is too ...
I very confusing with error "typescript expression produces a union type that is too complex to represent" in NextJS, React.
Read more >Matt Pocock on Twitter: "Reply with your TypeScript error ...
Reply with your TypeScript error message, and I'll translate it to plain ... Expression produces a union type that is too complex to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey so Iβm habing the same problem with this Jsx snippet.
Expression produces a union type that is too complex to represent.ts(2590)
Iβm on: β@chakra-ui/reactβ: β^1.1.0β, βnextβ: β10.0.4β, βtypescriptβ: β^4.1.2β
Solution
Use workspace version
selectedUPD: I have created a question+answer on stackoverflow. I hope it helps someone π