react-tooltip icon indicating copy to clipboard operation
react-tooltip copied to clipboard

ReactTooltip next.js dynamic import with typescript

Open Raepheles opened this issue 3 years ago • 0 comments

image

As you can see on the image above dynamically imported react-tooltip component doesn't show any of its static methods or TooltipProps for that matter. When component is directly imported from react-tooltip it returns the ReactTooltip class that extends React.Component<TooltipProps> but when it is imported dynamically with next.js it returns React.ComponentType<TooltipProps> as seen below.

image

Because of typescript compiler I cannot use rebuild method now when I need to. Also from what I see next.js dynamic always returns React.ComponentType so I cannot change the return type to be ReactTooltip class. Is there a way around this (while still using dynamic import)?

Raepheles avatar Mar 29 '22 08:03 Raepheles