Skip to content

Commit

Permalink
Fix remaining React 19 types compat issues
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed May 2, 2024
1 parent 23c0c22 commit a752cc6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/components/Provider.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ describe('React', () => {
action.type === 'INC' ? state + 1 : state

const innerStore = createStore(reducer)
const innerMapStateToProps = vi.fn<TStateProps, [number]>((state) => ({
const innerMapStateToProps = vi.fn<[number], TStateProps>((state) => ({
count: state,
}))
class Inner extends Component<TStateProps> {
Expand Down
7 changes: 4 additions & 3 deletions test/typetests/connect-options-and-issues.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -801,16 +801,17 @@ function testRef() {
ref={(ref: number) => {}}
></ConnectedForwardedFunctionalComponent>

// Should be able to use all refs including legacy string
const classLegacyRef: React.LegacyRef<ClassComponent> | undefined = undefined
// Should be able to use all refs (except legacy string refs, which go away in React 19)
const classLegacyRef: React.Ref<ClassComponent> | undefined = undefined
;<ConnectedClassComponent ref={classLegacyRef}></ConnectedClassComponent>
;<ConnectedClassComponent
ref={React.createRef<ClassComponent>()}
></ConnectedClassComponent>
;<ConnectedClassComponent
ref={(ref: ClassComponent) => {}}
></ConnectedClassComponent>
;<ConnectedClassComponent ref={''}></ConnectedClassComponent>
// TODO Can make this an expected error if we target React 19 exclusively
// ;<ConnectedClassComponent ref={''}></ConnectedClassComponent>
// ref type should be the typeof the wrapped component
;<ConnectedClassComponent
// @ts-expect-error
Expand Down

0 comments on commit a752cc6

Please sign in to comment.