Skip to content

Commit eec5f9b

Browse files
authored
Merge pull request #2168 from reduxjs/feature/react-19-types
2 parents bfa3c36 + a752cc6 commit eec5f9b

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
"@testing-library/react": "^14.1.2",
8484
"@testing-library/react-hooks": "^8.0.1",
8585
"@types/node": "^20.11.6",
86+
"@types/prop-types": "^15.7.12",
8687
"@types/react": "18.2.25",
8788
"@typescript-eslint/eslint-plugin": "^6.17.0",
8889
"@typescript-eslint/parser": "^6.17.0",

test/components/Provider.spec.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ describe('React', () => {
169169
action.type === 'INC' ? state + 1 : state
170170

171171
const innerStore = createStore(reducer)
172-
const innerMapStateToProps = vi.fn<TStateProps, [number]>((state) => ({
172+
const innerMapStateToProps = vi.fn<[number], TStateProps>((state) => ({
173173
count: state,
174174
}))
175175
class Inner extends Component<TStateProps> {

test/typetests/connect-options-and-issues.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -801,16 +801,17 @@ function testRef() {
801801
ref={(ref: number) => {}}
802802
></ConnectedForwardedFunctionalComponent>
803803

804-
// Should be able to use all refs including legacy string
805-
const classLegacyRef: React.LegacyRef<ClassComponent> | undefined = undefined
804+
// Should be able to use all refs (except legacy string refs, which go away in React 19)
805+
const classLegacyRef: React.Ref<ClassComponent> | undefined = undefined
806806
;<ConnectedClassComponent ref={classLegacyRef}></ConnectedClassComponent>
807807
;<ConnectedClassComponent
808808
ref={React.createRef<ClassComponent>()}
809809
></ConnectedClassComponent>
810810
;<ConnectedClassComponent
811811
ref={(ref: ClassComponent) => {}}
812812
></ConnectedClassComponent>
813-
;<ConnectedClassComponent ref={''}></ConnectedClassComponent>
813+
// TODO Can make this an expected error if we target React 19 exclusively
814+
// ;<ConnectedClassComponent ref={''}></ConnectedClassComponent>
814815
// ref type should be the typeof the wrapped component
815816
;<ConnectedClassComponent
816817
// @ts-expect-error

yarn.lock

+8
Original file line numberDiff line numberDiff line change
@@ -2362,6 +2362,13 @@ __metadata:
23622362
languageName: node
23632363
linkType: hard
23642364

2365+
"@types/prop-types@npm:^15.7.12":
2366+
version: 15.7.12
2367+
resolution: "@types/prop-types@npm:15.7.12"
2368+
checksum: 10/ac16cc3d0a84431ffa5cfdf89579ad1e2269549f32ce0c769321fdd078f84db4fbe1b461ed5a1a496caf09e637c0e367d600c541435716a55b1d9713f5035dfe
2369+
languageName: node
2370+
linkType: hard
2371+
23652372
"@types/react-dom@npm:^18.0.0":
23662373
version: 18.2.18
23672374
resolution: "@types/react-dom@npm:18.2.18"
@@ -7131,6 +7138,7 @@ __metadata:
71317138
"@testing-library/react": "npm:^14.1.2"
71327139
"@testing-library/react-hooks": "npm:^8.0.1"
71337140
"@types/node": "npm:^20.11.6"
7141+
"@types/prop-types": "npm:^15.7.12"
71347142
"@types/react": "npm:18.2.25"
71357143
"@types/use-sync-external-store": "npm:^0.0.3"
71367144
"@typescript-eslint/eslint-plugin": "npm:^6.17.0"

0 commit comments

Comments
 (0)