Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

153
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda