[@types/react-slick] causes type errors when used in a project with react versions <19

Author: mlequimeCreated Feb 6, 2025Updated Apr 28, 2026

This section:

"dependencies": {
  "@types/react": "*"

Loads React 19 as part of this typing library, which causes a type mismatch in React.Component due to the deprecation of refs.

Could be changed to peerDependencies and "@types/react": "^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0 || ^18.0.0", to match react-slick's definition

Error log:

Type error: 'Slider' cannot be used as a JSX component.
  Its type 'typeof Slider' is not a valid JSX element type.
    Types of construct signatures are incompatible.
      Type 'new (props: Settings) => Slider' is not assignable to type 'new (props: any, deprecatedLegacyContext?: any) => Component<any, any, any>'.
        Property 'refs' is missing in type 'Slider' but required in type 'Component<any, any, any>'.
  37 | 			onMouseLeave={() => setIsDragging(false)}
  38 | 		>
> 39 | 			<Slider
     | 			 ^
  40 | 				infinite
  41 | 				ref={sliderRef}
  42 | 				autoplay

Source: DefinitelyTyped/DefinitelyTyped