Coder Social home page Coder Social logo

Comments (4)

akkadaya avatar akkadaya commented on June 10, 2024 4

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/post_install.sh and then add this line to your package.json scripts

  "scripts": {
    ...
    "postinstall": "scripts/post_install.sh"

make sure to make the script executable by running

chmod +x post_install.sh

from styled-components.

akkadaya avatar akkadaya commented on June 10, 2024 2

Thank you @quantizor

When you hover over a component created by Styled Components, it infers the type IStyledComponentBase
image

But I believe it was meant to be IStyledComponent instead
image

from styled-components.

quantizor avatar quantizor commented on June 10, 2024 1

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

from styled-components.

TomasMoratoPerezPorro avatar TomasMoratoPerezPorro commented on June 10, 2024

I'm having an issue that coul be related, after upgrading to Styled 6 i get the following error in all my styled components:

export const Relative = styled(Div)<PositionProps>`
	position: relative;
	z-index: ${({ zIndex }) => zIndex};
`;

Exported variable 'Relative' has or is using name 'IStyledComponentBase' from external module "C:/.../project/node_modules/styled-components/dist/types" but cannot be named.ts(4023)

Any idea of how could it be fixed ?

from styled-components.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.