I am developing some reusable components in React Native. I have defined some PropTypes for components but when I publish the components to my private npm repository the Props Intellisense doesn't work.
As an example if I define a title propType, when I add the component to another component if I start typing t... it doesn't suggest title to me.
How can I fix this issue?
You can use augments to do that. Just define your props in the augments part they will appear in the suggestions as you type.
/**
* @augments {Component<{ title:string, anotherProp:boolean>}
*/
class MyReactClass extends React.Component {
}
If you're using vscode, I've created a simple extension to do that automatically. But it requires you to define propTypes.
https://marketplace.visualstudio.com/items?itemName=cuneyt-aliustaoglu.vscode-react-proptypes-intellisense