Regression: `typeof` on a styled component returns incompatible type

Author: sametttttCreated May 7, 2024Updated Mar 23, 2026

Environment

System:

  • OS: macOS 14.4.1
  • CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
  • Memory: 1.01 GB / 32.00 GB
  • Shell: 5.9 - /bin/zsh

Binaries:

  • Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
  • Yarn: 3.8.1 - ~/.nvm/versions/node/v20.12.2/bin/yarn
  • npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm

Reproduction

https://stackblitz.com/edit/vitejs-vite-esazjv?file=src%2FApp.tsx,package.json

Steps to reproduce

typescript
import styled from 'styled-components';

const One = styled.div``;
const Two = styled(One)``;

const foo = (component: typeof One) => {
  // do something
};

foo(Two);

Expected Behavior

No type error.

Actual Behavior

Screenshot 2024-05-07 at 11 18 02

Source: styled-components/styled-components