Skip to content

Commit

Permalink
Add React.PropsWithChildren where needed (#17946)
Browse files Browse the repository at this point in the history
  • Loading branch information
timroes authored Oct 13, 2022
1 parent 9836c11 commit 3268cfe
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { act, render as tlr } from "@testing-library/react";
import React from "react";
import mockConnection from "test-utils/mock-data/mockConnection.json";
import mockDest from "test-utils/mock-data/mockDestinationDefinition.json";
import { TestWrapper } from "test-utils/testutils";
Expand All @@ -19,7 +20,7 @@ jest.mock("services/workspaces/WorkspacesService", () => ({
}));

describe("CreateConnectionForm", () => {
const Wrapper: React.FC = ({ children }) => <TestWrapper>{children}</TestWrapper>;
const Wrapper: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => <TestWrapper>{children}</TestWrapper>;
const render = async () => {
let renderResult: ReturnType<typeof tlr>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface TextInputContainerProps {
onBlur?: React.FocusEventHandler<HTMLDivElement>;
}

export const TextInputContainer: React.FC<TextInputContainerProps> = ({
export const TextInputContainer: React.FC<React.PropsWithChildren<TextInputContainerProps>> = ({
disabled,
light,
error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ const ConnectionEditContext = createContext<Omit<
"refreshSchema" | "schemaError"
> | null>(null);

export const ConnectionEditServiceProvider: React.FC<ConnectionEditProps> = ({ children, ...props }) => {
export const ConnectionEditServiceProvider: React.FC<React.PropsWithChildren<ConnectionEditProps>> = ({
children,
...props
}) => {
const { refreshSchema, schemaError, ...data } = useConnectionEdit(props);
return (
<ConnectionEditContext.Provider value={data}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ const useConnectionForm = ({ connection, mode, schemaError, refreshSchema }: Con

const ConnectionFormContext = createContext<ReturnType<typeof useConnectionForm> | null>(null);

export const ConnectionFormServiceProvider: React.FC<ConnectionServiceProps> = ({ children, ...props }) => {
export const ConnectionFormServiceProvider: React.FC<React.PropsWithChildren<ConnectionServiceProps>> = ({
children,
...props
}) => {
const data = useConnectionForm(props);
return <ConnectionFormContext.Provider value={data}>{children}</ConnectionFormContext.Provider>;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createContext, useContext, useMemo } from "react";
import React, { createContext, useContext, useMemo } from "react";
import { useToggle } from "react-use";

import { InviteUsersModal } from "packages/cloud/views/users/InviteUsersModal";
Expand All @@ -19,7 +19,7 @@ export const useInviteUsersModalService = () => {
return ctx;
};

export const InviteUsersModalServiceProvider: React.FC = ({ children }) => {
export const InviteUsersModalServiceProvider: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => {
const [isOpen, toggleIsOpen] = useToggle(false);

const contextValue = useMemo<InviteUsersModalServiceContext>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */

import { render as tlr, act } from "@testing-library/react";
import { Suspense } from "react";
import React, { Suspense } from "react";
import mockConnection from "test-utils/mock-data/mockConnection.json";
import mockDest from "test-utils/mock-data/mockDestinationDefinition.json";
import { TestWrapper } from "test-utils/testutils";
Expand All @@ -18,7 +18,7 @@ jest.mock("services/connector/DestinationDefinitionSpecificationService", () =>
}));

describe("ConnectionReplicationTab", () => {
const Wrapper: React.FC = ({ children }) => (
const Wrapper: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => (
<Suspense fallback={<div>I should not show up in a snapshot</div>}>
<TestWrapper>
<ConnectionEditServiceProvider connectionId={mockConnection.connectionId}>
Expand Down

0 comments on commit 3268cfe

Please sign in to comment.