Closed janhesters closed 3 years ago
There seems to be some compatibility issues between how we type the as
prop vs. how Emotion does it. Honestly not sure this is worth spending the time on right now, as our typing for as
will likely (hopefully!) change soon anyway if this issue ever gets resolved. In the mean time, casting might be a good workaround: https://codesandbox.io/s/reach-bug-forked-ybj27?file=/src/App.tsx:162-176
Looks like this should be fixed in 0.15.0 https://codesandbox.io/s/reach-bug-forked-5t6hd
🐛 Bug report
Note: This might not be a bug report. I also posted the question here on SO. I posted it here for the issues because in the docs for overriding styles it asks you to file a bug report when the documented example doesn't work.
Current Behavior
I'm using Next.js with TypeScript, Reach and Emotion. I want to style the
menu-button
components.TypeScript complains:
with this TypeScript error.
``` error TS2769: No overload matches this call. Overload 1 of 6, '(component: ComponentClassExpected behavior
I can style the
MenuButton
and its components without type errors.Reproducible example
CodeSandbox Template
Suggested solution(s)
The Reach team could document how to use TypeScript and Emotion with their library or make sure the typings work with the
styled
syntax.Your environment