From 23c0c228d6518be55366bec8c3367252749b84ef Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Wed, 1 May 2024 21:20:48 -0400 Subject: [PATCH 1/2] Add explicit @types/prop-types dep --- package.json | 1 + yarn.lock | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/package.json b/package.json index ae698698e..b1a6e3e38 100644 --- a/package.json +++ b/package.json @@ -83,6 +83,7 @@ "@testing-library/react": "^14.1.2", "@testing-library/react-hooks": "^8.0.1", "@types/node": "^20.11.6", + "@types/prop-types": "^15.7.12", "@types/react": "18.2.25", "@typescript-eslint/eslint-plugin": "^6.17.0", "@typescript-eslint/parser": "^6.17.0", diff --git a/yarn.lock b/yarn.lock index 096b31037..6a85b20b1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2362,6 +2362,13 @@ __metadata: languageName: node linkType: hard +"@types/prop-types@npm:^15.7.12": + version: 15.7.12 + resolution: "@types/prop-types@npm:15.7.12" + checksum: 10/ac16cc3d0a84431ffa5cfdf89579ad1e2269549f32ce0c769321fdd078f84db4fbe1b461ed5a1a496caf09e637c0e367d600c541435716a55b1d9713f5035dfe + languageName: node + linkType: hard + "@types/react-dom@npm:^18.0.0": version: 18.2.18 resolution: "@types/react-dom@npm:18.2.18" @@ -7131,6 +7138,7 @@ __metadata: "@testing-library/react": "npm:^14.1.2" "@testing-library/react-hooks": "npm:^8.0.1" "@types/node": "npm:^20.11.6" + "@types/prop-types": "npm:^15.7.12" "@types/react": "npm:18.2.25" "@types/use-sync-external-store": "npm:^0.0.3" "@typescript-eslint/eslint-plugin": "npm:^6.17.0" From a752cc66792b067b0494b501886986446cd581c2 Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Wed, 1 May 2024 21:21:21 -0400 Subject: [PATCH 2/2] Fix remaining React 19 types compat issues --- test/components/Provider.spec.tsx | 2 +- test/typetests/connect-options-and-issues.tsx | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/test/components/Provider.spec.tsx b/test/components/Provider.spec.tsx index b6caf0f37..1c9dce755 100644 --- a/test/components/Provider.spec.tsx +++ b/test/components/Provider.spec.tsx @@ -169,7 +169,7 @@ describe('React', () => { action.type === 'INC' ? state + 1 : state const innerStore = createStore(reducer) - const innerMapStateToProps = vi.fn((state) => ({ + const innerMapStateToProps = vi.fn<[number], TStateProps>((state) => ({ count: state, })) class Inner extends Component { diff --git a/test/typetests/connect-options-and-issues.tsx b/test/typetests/connect-options-and-issues.tsx index be23afc4b..1579397c4 100644 --- a/test/typetests/connect-options-and-issues.tsx +++ b/test/typetests/connect-options-and-issues.tsx @@ -801,8 +801,8 @@ function testRef() { ref={(ref: number) => {}} > - // Should be able to use all refs including legacy string - const classLegacyRef: React.LegacyRef | undefined = undefined + // Should be able to use all refs (except legacy string refs, which go away in React 19) + const classLegacyRef: React.Ref | undefined = undefined ; ;()} @@ -810,7 +810,8 @@ function testRef() { ; {}} > - ; + // TODO Can make this an expected error if we target React 19 exclusively + // ; // ref type should be the typeof the wrapped component ;