Skip to content

Commit a752cc6

Browse files
committed
Fix remaining React 19 types compat issues
1 parent 23c0c22 commit a752cc6

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

test/components/Provider.spec.tsx

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 3 deletions
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

0 commit comments

Comments
 (0)