set PropsWithChildren as explicit type on components

Signed-off-by: Oleg S <97077423+RobotSail@users.noreply.github.com>
This commit is contained in:
Oleg S
2023-05-05 13:26:58 -04:00
committed by Fredrik Adelöw
parent 38d8ad9373
commit 74b216ee4e
64 changed files with 149 additions and 110 deletions
@@ -30,7 +30,7 @@ describe('<ApiDefinitionCard />', () => {
const apiDocsConfig: jest.Mocked<ApiDocsConfig> = {
getApiDefinitionWidget: jest.fn(),
} as any;
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
Wrapper = ({ children }: { children?: React.ReactNode }) => (
@@ -24,7 +24,7 @@ describe('<ApiTypeTitle />', () => {
const apiDocsConfig: jest.Mocked<ApiDocsConfig> = {
getApiDefinitionWidget: jest.fn(),
} as any;
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
Wrapper = ({ children }: { children?: React.ReactNode }) => (
@@ -39,7 +39,7 @@ describe('<ConsumedApisCard />', () => {
getLocationByRef: jest.fn(),
removeEntityByUid: jest.fn(),
} as any;
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
Wrapper = ({ children }: { children?: React.ReactNode }) => (
@@ -39,7 +39,7 @@ describe('<HasApisCard />', () => {
getLocationByRef: jest.fn(),
removeEntityByUid: jest.fn(),
} as any;
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
Wrapper = ({ children }: { children?: React.ReactNode }) => (
@@ -39,7 +39,7 @@ describe('<ProvidedApisCard />', () => {
getLocationByRef: jest.fn(),
removeEntityByUid: jest.fn(),
} as any;
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
Wrapper = ({ children }: { children?: React.ReactNode }) => (
@@ -35,7 +35,7 @@ describe('<ConsumingComponentsCard />', () => {
getLocationByRef: jest.fn(),
removeEntityByUid: jest.fn(),
} as any;
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
Wrapper = ({ children }: { children?: React.ReactNode }) => (
@@ -35,7 +35,7 @@ describe('<ProvidingComponentsCard />', () => {
getLocationByRef: jest.fn(),
removeEntityByUid: jest.fn(),
} as any;
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
Wrapper = ({ children }: { children?: React.ReactNode }) => (
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
import {
EntityPeekAheadPopover,
EntityPeekAheadPopoverProps,
@@ -80,7 +80,7 @@ const defaultArgs = {
export default {
title: 'Catalog /PeekAheadPopover',
decorators: [
(Story: ComponentType<{}>) =>
(Story: ComponentType<PropsWithChildren<{}>>) =>
wrapInTestApp(
<>
<TestApiProvider
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
import { EntityRefLink, EntityRefLinkProps } from './EntityRefLink';
import { wrapInTestApp } from '@backstage/test-utils';
import { entityRouteRef } from '../../routes';
@@ -26,7 +26,7 @@ const defaultArgs = {
export default {
title: 'Catalog /EntityRefLink',
decorators: [
(Story: ComponentType<{}>) =>
(Story: ComponentType<PropsWithChildren<{}>>) =>
wrapInTestApp(<Story />, {
mountedRoutes: {
'/catalog/:namespace/:kind/:name': entityRouteRef,
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
import { EntityRefLinks, EntityRefLinksProps } from './EntityRefLinks';
import { wrapInTestApp } from '@backstage/test-utils';
import { CompoundEntityRef } from '@backstage/catalog-model';
@@ -27,7 +27,7 @@ const defaultArgs = {
export default {
title: 'Catalog /EntityRefLinks',
decorators: [
(Story: ComponentType<{}>) =>
(Story: ComponentType<PropsWithChildren<{}>>) =>
wrapInTestApp(<Story />, {
mountedRoutes: {
'/catalog/:namespace/:kind/:name': entityRouteRef,
@@ -27,7 +27,7 @@ import { useStarredEntities } from './useStarredEntities';
describe('useStarredEntities', () => {
let mockApi: StarredEntitiesApi;
let wrapper: React.ComponentType;
let wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
const mockEntity: Entity = {
apiVersion: '1',
@@ -27,7 +27,7 @@ describe('useStarredEntity', () => {
toggleStarred: jest.fn(),
starredEntitie$: jest.fn(),
};
let wrapper: React.ComponentType;
let wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
wrapper = (props: PropsWithChildren<{}>) => (
@@ -28,7 +28,7 @@ import { DependencyOfComponentsCard } from './DependencyOfComponentsCard';
describe('<DependencyOfComponentsCard />', () => {
const getEntities: jest.MockedFunction<CatalogApi['getEntities']> = jest.fn();
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
Wrapper = ({ children }: { children?: React.ReactNode }) => (
@@ -28,7 +28,7 @@ import { DependsOnComponentsCard } from './DependsOnComponentsCard';
describe('<DependsOnComponentsCard />', () => {
const getEntities: jest.MockedFunction<CatalogApi['getEntities']> = jest.fn();
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
Wrapper = ({ children }: { children?: React.ReactNode }) => (
@@ -28,7 +28,7 @@ import { DependsOnResourcesCard } from './DependsOnResourcesCard';
describe('<DependsOnResourcesCard />', () => {
const getEntities: jest.MockedFunction<CatalogApi['getEntities']> = jest.fn();
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
Wrapper = ({ children }: { children?: React.ReactNode }) => (
@@ -28,7 +28,7 @@ import { HasComponentsCard } from './HasComponentsCard';
describe('<HasComponentsCard />', () => {
const getEntities: jest.MockedFunction<CatalogApi['getEntities']> = jest.fn();
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
Wrapper = ({ children }: { children?: React.ReactNode }) => (
@@ -28,7 +28,7 @@ import { HasResourcesCard } from './HasResourcesCard';
describe('<HasResourcesCard />', () => {
const getEntities: jest.MockedFunction<CatalogApi['getEntities']> = jest.fn();
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
Wrapper = ({ children }: { children?: React.ReactNode }) => (
@@ -28,7 +28,7 @@ import { HasSubcomponentsCard } from './HasSubcomponentsCard';
describe('<HasSubcomponentsCard />', () => {
const getEntities: jest.MockedFunction<CatalogApi['getEntities']> = jest.fn();
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
Wrapper = ({ children }: { children?: React.ReactNode }) => (
@@ -28,7 +28,7 @@ import { HasSystemsCard } from './HasSystemsCard';
describe('<HasSystemsCard />', () => {
const getEntities: jest.MockedFunction<CatalogApi['getEntities']> = jest.fn();
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
Wrapper = ({ children }: { children?: React.ReactNode }) => (
@@ -26,7 +26,7 @@ describe('<FossaCard />', () => {
getFindingSummary: jest.fn(),
getFindingSummaries: jest.fn(),
};
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
Wrapper = ({ children }: { children?: React.ReactNode }) => (
@@ -38,7 +38,7 @@ describe('<FossaPage />', () => {
getFindingSummary: jest.fn(),
getFindingSummaries: jest.fn(),
};
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
Wrapper = ({ children }: { children?: React.ReactNode }) => (
@@ -21,12 +21,12 @@ import { wrapInTestApp, TestApiProvider } from '@backstage/test-utils';
import { configApiRef } from '@backstage/core-plugin-api';
import { ConfigReader } from '@backstage/core-app-api';
import { Grid, makeStyles } from '@material-ui/core';
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
export default {
title: 'Plugins/Home/Components/CompanyLogo',
decorators: [
(Story: ComponentType<{}>) =>
(Story: ComponentType<PropsWithChildren<{}>>) =>
wrapInTestApp(
<TestApiProvider
apis={[
@@ -16,12 +16,14 @@
import { Header } from '@backstage/core-components';
import { wrapInTestApp } from '@backstage/test-utils';
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
import { ClockConfig, HeaderWorldClock } from './HeaderWorldClock';
export default {
title: 'Plugins/Home/Components/HeaderWorldClock',
decorators: [(Story: ComponentType<{}>) => wrapInTestApp(<Story />)],
decorators: [
(Story: ComponentType<PropsWithChildren<{}>>) => wrapInTestApp(<Story />),
],
};
export const Default = () => {
@@ -23,7 +23,7 @@ import {
entityRouteRef,
} from '@backstage/plugin-catalog-react';
import { Grid } from '@material-ui/core';
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
const starredEntitiesApi = new MockStarredEntitiesApi();
starredEntitiesApi.toggleStarred('component:default/example-starred-entity');
@@ -73,7 +73,7 @@ const mockCatalogApi = {
export default {
title: 'Plugins/Home/Components/StarredEntities',
decorators: [
(Story: ComponentType<{}>) =>
(Story: ComponentType<PropsWithChildren<{}>>) =>
wrapInTestApp(
<TestApiProvider
apis={[
@@ -17,14 +17,16 @@
import { InfoCard } from '@backstage/core-components';
import { wrapInTestApp } from '@backstage/test-utils';
import { Grid } from '@material-ui/core';
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
import { ComponentAccordion } from '../../componentRenderers';
import { HomePageToolkit } from '../../plugin';
import { TemplateBackstageLogoIcon } from '../../assets';
export default {
title: 'Plugins/Home/Components/Toolkit',
decorators: [(Story: ComponentType<{}>) => wrapInTestApp(<Story />)],
decorators: [
(Story: ComponentType<PropsWithChildren<{}>>) => wrapInTestApp(<Story />),
],
};
export const Default = () => {
@@ -16,12 +16,14 @@
import { Header } from '@backstage/core-components';
import { wrapInTestApp } from '@backstage/test-utils';
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
import { WelcomeTitle } from './WelcomeTitle';
export default {
title: 'Plugins/Home/Components/WelcomeTitle',
decorators: [(Story: ComponentType<{}>) => wrapInTestApp(<Story />)],
decorators: [
(Story: ComponentType<PropsWithChildren<{}>>) => wrapInTestApp(<Story />),
],
};
export const Default = () => {
@@ -23,7 +23,7 @@ import {
} from '@backstage/plugin-catalog-react';
import { TestApiProvider, wrapInTestApp } from '@backstage/test-utils';
import { Grid } from '@material-ui/core';
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
import { GroupProfileCard } from './GroupProfileCard';
const dummyDepartment = {
@@ -74,7 +74,7 @@ export default {
title: 'Plugins/Org/Group Profile Card',
component: GroupProfileCard,
decorators: [
(Story: ComponentType<{}>) =>
(Story: ComponentType<PropsWithChildren<{}>>) =>
wrapInTestApp(
<TestApiProvider apis={[[catalogApiRef, catalogApi]]}>
<Story />
@@ -21,7 +21,7 @@ import {
} from '@backstage/plugin-catalog-react';
import { wrapInTestApp } from '@backstage/test-utils';
import { Grid } from '@material-ui/core';
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
import { UserProfileCard } from './UserProfileCard';
const dummyGroup = {
@@ -94,7 +94,7 @@ export default {
title: 'Plugins/Org/User Profile Card',
component: UserProfileCard,
decorators: [
(Story: ComponentType<{}>) =>
(Story: ComponentType<PropsWithChildren<{}>>) =>
wrapInTestApp(<Story />, {
mountedRoutes: {
'/a': entityRouteRef,
+3 -1
View File
@@ -207,7 +207,9 @@ export interface ScaffolderGetIntegrationsListResponse {
}
// @public
export const ScaffolderLayouts: React.ComponentType;
export const ScaffolderLayouts: React_2.ComponentType<
React_2.PropsWithChildren<{}>
>;
// @public (undocumented)
export type ScaffolderOutputLink = {
@@ -17,6 +17,7 @@
import { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from './keys';
import { attachComponentData, Extension } from '@backstage/core-plugin-api';
import type { FormProps as SchemaFormProps } from '@rjsf/core-v5';
import React from 'react';
/**
* The field template from `@rjsf/core` which is a react component that gets passed `@rjsf/core` field related props.
@@ -67,7 +68,8 @@ export function createScaffolderLayout<TInputProps = unknown>(
*
* @public
*/
export const ScaffolderLayouts: React.ComponentType = (): JSX.Element | null =>
null;
export const ScaffolderLayouts: React.ComponentType<
React.PropsWithChildren<{}>
> = (): JSX.Element | null => null;
attachComponentData(ScaffolderLayouts, LAYOUTS_WRAPPER_KEY, true);
+1 -1
View File
@@ -27,7 +27,7 @@ export type NextRouterProps = {
TemplateCardComponent?: React_2.ComponentType<{
template: TemplateEntityV1beta3;
}>;
TaskPageComponent?: React_2.ComponentType<{}>;
TaskPageComponent?: React_2.ComponentType<PropsWithChildren<{}>>;
TemplateOutputsComponent?: React_2.ComponentType<{
output?: ScaffolderTaskOutput;
}>;
+5 -2
View File
@@ -29,6 +29,7 @@ import { ListActionsResponse as ListActionsResponse_2 } from '@backstage/plugin-
import { LogEvent as LogEvent_2 } from '@backstage/plugin-scaffolder-react';
import { Observable } from '@backstage/types';
import { PathParams } from '@backstage/core-plugin-api';
import { PropsWithChildren } from 'react';
import { default as React_2 } from 'react';
import { ReactNode } from 'react';
import { RouteRef } from '@backstage/core-plugin-api';
@@ -382,7 +383,7 @@ export type RouterProps = {
template: TemplateEntityV1beta3;
}>
| undefined;
TaskPageComponent?: ComponentType<{}>;
TaskPageComponent?: ComponentType<PropsWithChildren<{}>>;
};
groups?: Array<{
title?: React_2.ReactNode;
@@ -466,7 +467,9 @@ export type ScaffolderGetIntegrationsListResponse =
ScaffolderGetIntegrationsListResponse_2;
// @public @deprecated (undocumented)
export const ScaffolderLayouts: ComponentType<{}>;
export const ScaffolderLayouts: ComponentType<{
children?: ReactNode;
}>;
// @public @deprecated (undocumented)
export type ScaffolderOutputlink = ScaffolderOutputLink;
+2 -2
View File
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { ComponentType, useEffect } from 'react';
import React, { ComponentType, useEffect, PropsWithChildren } from 'react';
import { Navigate, Route, Routes, useOutlet } from 'react-router-dom';
import { Entity } from '@backstage/catalog-model';
import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';
@@ -52,7 +52,7 @@ export type RouterProps = {
TemplateCardComponent?:
| ComponentType<{ template: TemplateEntityV1beta3 }>
| undefined;
TaskPageComponent?: ComponentType<{}>;
TaskPageComponent?: ComponentType<PropsWithChildren<{}>>;
};
groups?: Array<{
title?: React.ReactNode;
@@ -49,7 +49,7 @@ describe('<EntityPicker />', () => {
getLocationByRef: jest.fn(),
removeEntityByUid: jest.fn(),
} as any;
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
entities = [
@@ -55,7 +55,7 @@ describe('<OwnerPicker />', () => {
getLocationByRef: jest.fn(),
removeEntityByUid: jest.fn(),
} as any;
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
beforeEach(() => {
entities = [
@@ -58,7 +58,7 @@ export type NextRouterProps = {
TemplateCardComponent?: React.ComponentType<{
template: TemplateEntityV1beta3;
}>;
TaskPageComponent?: React.ComponentType<{}>;
TaskPageComponent?: React.ComponentType<PropsWithChildren<{}>>;
TemplateOutputsComponent?: React.ComponentType<{
output?: ScaffolderTaskOutput;
}>;
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
import { Grid } from '@material-ui/core';
import LabelIcon from '@material-ui/icons/Label';
@@ -31,7 +31,7 @@ export default {
title: 'Plugins/Search/SearchAutocomplete',
component: SearchAutocomplete,
decorators: [
(Story: ComponentType<{}>) => (
(Story: ComponentType<PropsWithChildren<{}>>) => (
<TestApiProvider apis={[[searchApiRef, new MockSearchApi()]]}>
<SearchContextProvider>
<Grid container direction="row">
@@ -30,7 +30,7 @@ export default {
title: 'Plugins/Search/SearchAutocompleteDefaultOption',
component: SearchAutocompleteDefaultOption,
decorators: [
(Story: ComponentType<{}>) => (
(Story: ComponentType<PropsWithChildren<{}>>) => (
<TestApiProvider apis={[[searchApiRef, new MockSearchApi()]]}>
<SearchContextProvider>
<Grid container direction="row">
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
import { Grid, makeStyles } from '@material-ui/core';
import { TestApiProvider } from '@backstage/test-utils';
@@ -28,7 +28,7 @@ export default {
title: 'Plugins/Search/SearchBar',
component: SearchBar,
decorators: [
(Story: ComponentType<{}>) => (
(Story: ComponentType<PropsWithChildren<{}>>) => (
<TestApiProvider apis={[[searchApiRef, new MockSearchApi()]]}>
<SearchContextProvider>
<Grid container direction="row">
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
import { Grid, Paper } from '@material-ui/core';
import { TestApiProvider } from '@backstage/test-utils';
@@ -27,7 +27,7 @@ export default {
title: 'Plugins/Search/SearchFilter',
component: SearchFilter,
decorators: [
(Story: ComponentType<{}>) => (
(Story: ComponentType<PropsWithChildren<{}>>) => (
<TestApiProvider apis={[[searchApiRef, new MockSearchApi()]]}>
<SearchContextProvider>
<Grid container direction="row">
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
import { Grid } from '@material-ui/core';
import { TestApiProvider } from '@backstage/test-utils';
@@ -28,7 +28,7 @@ export default {
title: 'Plugins/Search/SearchPagination',
component: SearchPagination,
decorators: [
(Story: ComponentType<{}>) => (
(Story: ComponentType<PropsWithChildren<{}>>) => (
<TestApiProvider apis={[[searchApiRef, new MockSearchApi()]]}>
<SearchContextProvider>
<Grid container direction="row">
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
import { List, ListItem } from '@material-ui/core';
import DefaultIcon from '@material-ui/icons/InsertDriveFile';
@@ -70,7 +70,7 @@ export default {
title: 'Plugins/Search/SearchResult',
component: SearchResult,
decorators: [
(Story: ComponentType<{}>) =>
(Story: ComponentType<PropsWithChildren<{}>>) =>
wrapInTestApp(
<TestApiProvider apis={[[searchApiRef, searchApiMock]]}>
<SearchContextProvider>
@@ -14,7 +14,12 @@
* limitations under the License.
*/
import React, { ComponentType, useCallback, useState } from 'react';
import React, {
ComponentType,
useCallback,
useState,
PropsWithChildren,
} from 'react';
import {
Grid,
@@ -72,7 +77,7 @@ export default {
title: 'Plugins/Search/SearchResultGroup',
component: SearchResultGroup,
decorators: [
(Story: ComponentType<{}>) =>
(Story: ComponentType<PropsWithChildren<{}>>) =>
wrapInTestApp(
<TestApiProvider apis={[[searchApiRef, searchApiMock]]}>
<Grid container direction="row">
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { ComponentType, useState } from 'react';
import React, { ComponentType, useState, PropsWithChildren } from 'react';
import { Grid, ListItem, ListItemIcon, ListItemText } from '@material-ui/core';
@@ -59,7 +59,7 @@ export default {
title: 'Plugins/Search/SearchResultList',
component: SearchResultList,
decorators: [
(Story: ComponentType<{}>) =>
(Story: ComponentType<PropsWithChildren<{}>>) =>
wrapInTestApp(
<TestApiProvider apis={[[searchApiRef, searchApiMock]]}>
<Grid container direction="row">
@@ -18,12 +18,12 @@ import { rootRouteRef, HomePageSearchBar } from '../../plugin';
import { searchApiRef } from '@backstage/plugin-search-react';
import { wrapInTestApp, TestApiProvider } from '@backstage/test-utils';
import { Grid, makeStyles } from '@material-ui/core';
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
export default {
title: 'Plugins/Home/Components/SearchBar',
decorators: [
(Story: ComponentType<{}>) =>
(Story: ComponentType<PropsWithChildren<{}>>) =>
wrapInTestApp(
<>
<TestApiProvider
@@ -25,7 +25,7 @@ import {
Paper,
} from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
import { rootRouteRef } from '../../plugin';
import {
SearchBar,
@@ -74,7 +74,7 @@ export default {
title: 'Plugins/Search/SearchModal',
component: SearchModal,
decorators: [
(Story: ComponentType<{}>) =>
(Story: ComponentType<PropsWithChildren<{}>>) =>
wrapInTestApp(
<TestApiProvider
apis={[[searchApiRef, new MockSearchApi(mockResults)]]}
@@ -18,7 +18,7 @@ import { Grid, Paper } from '@material-ui/core';
import CatalogIcon from '@material-ui/icons/MenuBook';
import DocsIcon from '@material-ui/icons/Description';
import UsersGroupsIcon from '@material-ui/icons/Person';
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
import { SearchType } from './SearchType';
import { TestApiProvider } from '@backstage/test-utils';
import {
@@ -31,7 +31,7 @@ export default {
title: 'Plugins/Search/SearchType',
component: SearchType,
decorators: [
(Story: ComponentType<{}>) => (
(Story: ComponentType<PropsWithChildren<{}>>) => (
<TestApiProvider apis={[[searchApiRef, new MockSearchApi()]]}>
<SearchContextProvider>
<Grid container direction="row">
@@ -19,7 +19,7 @@ import { wrapInTestApp, TestApiProvider } from '@backstage/test-utils';
import { configApiRef } from '@backstage/core-plugin-api';
import { ConfigReader } from '@backstage/config';
import { Grid } from '@material-ui/core';
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
import { StackOverflowIcon } from '../../icons';
import { stackOverflowApiRef } from '../../api';
@@ -46,7 +46,7 @@ export default {
title: 'Plugins/Home/Components/StackOverflow',
component: HomePageStackOverflowQuestions,
decorators: [
(Story: ComponentType<{}>) =>
(Story: ComponentType<PropsWithChildren<{}>>) =>
wrapInTestApp(
<>
<TestApiProvider
@@ -16,13 +16,15 @@
import { StackOverflowSearchResultListItem } from '../../plugin';
import { wrapInTestApp } from '@backstage/test-utils';
import React, { ComponentType } from 'react';
import React, { ComponentType, PropsWithChildren } from 'react';
import { StackOverflowIcon } from '../../icons';
export default {
title: 'Plugins/Search/StackOverflowResultListItem',
component: StackOverflowSearchResultListItem,
decorators: [(Story: ComponentType<{}>) => wrapInTestApp(<Story />)],
decorators: [
(Story: ComponentType<PropsWithChildren<{}>>) => wrapInTestApp(<Story />),
],
};
export const Default = () => {
@@ -26,7 +26,7 @@ import {
} from './useReaderState';
describe('useReaderState', () => {
let Wrapper: React.ComponentType;
let Wrapper: React.ComponentType<React.PropsWithChildren<{}>>;
const techdocsStorageApi: jest.Mocked<typeof techdocsStorageApiRef.T> = {
getApiOrigin: jest.fn(),
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { FC } from 'react';
import React, { FC, PropsWithChildren } from 'react';
import { renderHook } from '@testing-library/react-hooks';
import { ConfigReader } from '@backstage/core-app-api';
@@ -31,7 +31,7 @@ const configApiMock: ConfigApi = new ConfigReader({
},
});
const wrapper: FC = ({ children }) => (
const wrapper: FC<PropsWithChildren<{}>> = ({ children }) => (
<TestApiProvider apis={[[configApiRef, configApiMock]]}>
{children}
</TestApiProvider>