Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!