New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error TS4023 when compiling a library that uses "styled-components": "^6.1.9" #4299
Comments
I'm having an issue that coul be related, after upgrading to Styled 6 i get the following error in all my styled components:
Any idea of how could it be fixed ? |
I raised a PR to fix it #4300 Meanwhile, use this script as a workaround. #!/usr/bin/env bash
set -euo pipefail
echo 'Applying fix to Styled-Components types...'
os=$(uname -s)
case $os in
Darwin)
sed -i '' 's/^interface IStyledComponentBase/export interface IStyledComponentBase/g' node_modules/styled-components/dist/types.d.ts
;;
Linux)
sed -i 's/^interface IStyledComponentBase/export interface IStyledComponentBase/g' node_modules/styled-components/dist/types.d.ts
;;
esac Let's say you save it in "scripts": {
...
"postinstall": "scripts/post_install.sh" make sure to make the script executable by running chmod +x post_install.sh |
Fix should be here I think, though I don't understand why TS should require an internal type to be exposed https://github.com/styled-components/styled-components/releases/tag/v6.1.10 |
Thank you @quantizor When you hover over a component created by Styled Components, it infers the type |
I could compile the library after exporting the
IStyledComponentBase
interface innode_modules/styled-components/dist/types.d.ts
Here is the link to the interface in this repo:
styled-components/packages/styled-components/src/types.ts
Line 223 in f688bef
Am I doing something wrong? or is it a bug in
styled-components
that needs to be fixed?The text was updated successfully, but these errors were encountered: