diff --git a/package.json b/package.json index 587b65412..1c95d0824 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,8 @@ "@testing-library/react": "^14.1.2", "@testing-library/react-hooks": "^8.0.1", "@types/node": "^20.11.6", - "@types/react": "18.2.25", + "@types/prop-types": "^15.7.12", + "@types/react": "npm:types-react@19.0.0-alpha.2", "@typescript-eslint/eslint-plugin": "^6.17.0", "@typescript-eslint/parser": "^6.17.0", "babel-eslint": "^10.1.0", @@ -110,5 +111,9 @@ "typescript": "^5.4.2", "vitest": "^1.2.1" }, + "resolutions": { + "@types/react": "npm:types-react@19.0.0-alpha.2", + "@types/react-dom": "npm:types-react-dom@19.0.0-alpha.2" + }, "packageManager": "yarn@4.1.0" } diff --git a/src/components/connect.tsx b/src/components/connect.tsx index bdad73719..771a16551 100644 --- a/src/components/connect.tsx +++ b/src/components/connect.tsx @@ -641,13 +641,13 @@ function connect< }, [didStoreComeFromProps, contextValue, subscription]) // Set up refs to coordinate values between the subscription effect and the render logic - const lastChildProps = React.useRef() + const lastChildProps = React.useRef(undefined) const lastWrapperProps = React.useRef(wrapperProps) - const childPropsFromStoreUpdate = React.useRef() + const childPropsFromStoreUpdate = React.useRef(undefined) const renderIsScheduled = React.useRef(false) const isMounted = React.useRef(false) - const latestSubscriptionCallbackError = React.useRef() + const latestSubscriptionCallbackError = React.useRef(undefined) useIsomorphicLayoutEffect(() => { isMounted.current = true diff --git a/test/components/Provider.spec.tsx b/test/components/Provider.spec.tsx index 05b7704e9..b6caf0f37 100644 --- a/test/components/Provider.spec.tsx +++ b/test/components/Provider.spec.tsx @@ -1,7 +1,7 @@ /*eslint-disable react/prop-types*/ import * as rtl from '@testing-library/react' -import type { Dispatch } from 'react' +import type { Dispatch, JSX } from 'react' import React, { Component } from 'react' import type { Store } from 'redux' import { createStore } from 'redux' diff --git a/test/components/connect.spec.tsx b/test/components/connect.spec.tsx index 1a81606d5..81ff00094 100644 --- a/test/components/connect.spec.tsx +++ b/test/components/connect.spec.tsx @@ -1,7 +1,7 @@ /*eslint-disable react/prop-types*/ import * as rtl from '@testing-library/react' -import type { Dispatch, ElementType, MouseEvent, ReactNode } from 'react' +import type { Dispatch, ElementType, MouseEvent, ReactNode, JSX } from 'react' import React, { Component } from 'react' import type { Action, diff --git a/test/typetests/connect-options-and-issues.tsx b/test/typetests/connect-options-and-issues.tsx index be23afc4b..743d18eba 100644 --- a/test/typetests/connect-options-and-issues.tsx +++ b/test/typetests/connect-options-and-issues.tsx @@ -802,7 +802,7 @@ function testRef() { > // Should be able to use all refs including legacy string - const classLegacyRef: React.LegacyRef | undefined = undefined + const classLegacyRef: React.Ref | undefined = undefined ; ;()} @@ -810,6 +810,7 @@ function testRef() { ; {}} > + // @ts-expect-error String refs are no longer supported in React 19. ; // ref type should be the typeof the wrapped component ;