Skip to content

Commit

Permalink
chore: fix for diff between React 17/18's PropsWithChildren
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuoushub committed Aug 28, 2022
1 parent bb40141 commit c4d1652
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/router/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function isRoute(
return isReactElement(node) && node.type === Route
}

interface RouterProps extends RouterContextProviderProps {
export interface RouterProps extends RouterContextProviderProps {
trailingSlashes?: TrailingSlashesTypes
pageLoadingDelay?: number
}
Expand Down
7 changes: 4 additions & 3 deletions packages/testing/src/web/MockProviders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ export const mockAuthClient: AuthClient = {
type: 'custom',
}

export const MockProviders: React.FunctionComponent<PropsWithChildren> = ({
children,
}) => {
// TODO(pc): see if there are props we want to allow to be passed into our mock provider (e.g. AuthProviderProps)
export const MockProviders: React.FunctionComponent<
PropsWithChildren<unknown>
> = ({ children }) => {
return (
<AuthProvider client={mockAuthClient} type="custom">
<RedwoodProvider titleTemplate="%PageTitle | %AppTitle">
Expand Down
8 changes: 4 additions & 4 deletions packages/testing/src/web/MockRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React, { PropsWithChildren } from 'react'
// for jest and Storybook. Not doing so would cause an infinite loop.
// See: ./packages/core/config/src/configs/browser/jest.createConfig.ts
// @ts-ignore
import { isRoute } from '@redwoodjs/router/dist/router'
import { isRoute, RouterProps } from '@redwoodjs/router/dist/router'
import { flattenAll, replaceParams } from '@redwoodjs/router/dist/util'
// @ts-ignore
export * from '@redwoodjs/router/dist/index'
Expand All @@ -16,9 +16,9 @@ export const routes: { [routeName: string]: () => string } = {}
* We overwrite the default `Router` export.
* It populates the `routes.<pagename>()` utility object.
*/
export const Router: React.FunctionComponent<PropsWithChildren> = ({
children,
}) => {
export const Router: React.FunctionComponent<
PropsWithChildren<RouterProps>
> = ({ children }) => {
const flatChildArray = flattenAll(children)

flatChildArray.forEach((child) => {
Expand Down

0 comments on commit c4d1652

Please sign in to comment.