Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

159
Vistas
How can I apply a base component's propTypes to a styled-component?

Note that I am not using TypeScript, only JavaScript (jsx).

I am trying to style some buttons from a UI library using styled-components. When I try to implement that new styled button, the Intellisense in VSCode does not suggest any of the properties on the original component.

When implementing the Button directly, I can see the icon attribute/definition:

1

However, when I try creating a styled Button component, Intellisense is no longer functioning:

2

I have tried setting the defaultProps and propTypes of the styled component to that of the Button component, though this also does not work:

3

Am I doing something wrong, or is this not possible without TypeScript?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Not sure why is it happening so. Did you can try specifying proptypes like this for StyledButton ? It should work using this approach(even without typescript).

StyledButton.propTypes = {
  color: PropTypes.string
};

Instead of assigning it StyledButton.propTypes = Button.propTypes.

You can check more about it on official documentation - documentataion URL

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda