TypeError: Cannot use 'in' operator to search for 'gray' in undefined
See original GitHub issueI think there is a bug with the chakra typing, can anyone help to resolve this issue? This is what I get when using Chakra in a Create-React-App Typescript.
useVariantColorWarning
/node_modules/@chakra-ui/core/dist/es/utils/index.js:113
110 | var variantColorIsDefined = variantColor != null;
111 |
112 | if (variantColorIsDefined) {
> 113 | var variantColorExists = variantColor in theme.colors; // If variant color exists in theme object
| ^ 114 |
115 | if (!variantColorExists) {
116 | console.warn("You passed an invalid variantColor to the " + label + " Component. Variant color values must be a color key in the theme object that has '100' - '900' color values. Check http://chakra-ui.com/theme#colors to see possible values");
/node_modules/@chakra-ui/core/dist/es/Button/index.js:62
59 |
60 | // Wrong usage of `variantColor` prop is quite common
61 | // Let's add a warning hook that validates the passed variantColor
> 62 | useVariantColorWarning("Button", variantColor);
| ^ 63 | var buttonStyleProps = useButtonStyle({
64 | color: variantColor,
65 | variant: variant,
``
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
TypeError: cannot use 'in' operator to search for 'x' in 'y'
The in operator can only be used to check if a property is in an object. You can't search in strings, or in...
Read more >Uncaught TypeError: Cannot use 'in' operator to search for ...
The in operator only works on objects. You are using it on a string. Make sure your value is an object before you...
Read more >cannot use 'in' operator to search for vue
The in operator can only be used to check if a property is in an object. You can't search in strings, or in...
Read more >Cannot use 'in' operator to search for 'default' in undefined
hello, I clone this project in my local, and then i exec npm run dev, but in console errors come, Uncaught TypeError: Cannot...
Read more >JavaScript TypeError - Cannot use 'in' operator to search for 'X ...
This JavaScript exception Cannot use 'in' operator to search for 'X' in 'Y' occurs if in operator is used to search in strings,...
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
Hi @ivanjeremic,
This error shows up when you don’t wrap your
App
withThemeProvider
from Chakra.Here’s what you need to do:
Perhaps the “Getting Started” documentation should specify that < ThemeProvider > must be the outermost component?