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:
However, when I try creating a styled Button component, Intellisense is no longer functioning:
I have tried setting the defaultProps and propTypes of the styled component to that of the Button component, though this also does not work:
Am I doing something wrong, or is this not possible without TypeScript?
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