Let’s say you have a React component but the prop type isn’t exported:
import { MyComponent } from './MyComponent';
type Props = {};
To access the React component props, you can use React’s ComponentProps
utility:
import type { ComponentProps } from 'react';
import { MyComponent } from './MyComponent';
type Props = ComponentProps<typeof MyComponent>;
Here’s the single-liner:
type Props = React.ComponentProps<typeof MyComponent>;