style(react 18): explicitly declaring children as optional props

This is to facilitate the react 18 upgrade which introduced the requirement to explicily declare children as props
Helps to address #12252

Signed-off-by: Mark David Avery <mark@webark.cc>
This commit is contained in:
Mark David Avery
2022-12-28 11:13:50 -08:00
parent 79536d9df1
commit b8269de9f1
5 changed files with 21 additions and 6 deletions
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/plugin-techdocs-react': patch
'@backstage/plugin-scaffolder': patch
---
Explicitly declaring children as optional props to facilitate react 18 changes
+3 -1
View File
@@ -552,7 +552,9 @@ export interface ScaffolderDryRunResponse {
}
// @public
export const ScaffolderFieldExtensions: React_2.ComponentType;
export const ScaffolderFieldExtensions: React_2.ComponentType<
React_2.PropsWithChildren<{}>
>;
// @public
export interface ScaffolderGetIntegrationsListOptions {
+3 -2
View File
@@ -94,8 +94,9 @@ export function createNextScaffolderFieldExtension<
*
* @public
*/
export const ScaffolderFieldExtensions: React.ComponentType =
(): JSX.Element | null => null;
export const ScaffolderFieldExtensions: React.ComponentType<
React.PropsWithChildren<{}>
> = (): JSX.Element | null => null;
attachComponentData(
ScaffolderFieldExtensions,
+3 -1
View File
@@ -56,7 +56,9 @@ export type TechDocsAddonOptions<TAddonProps = {}> = {
};
// @public
export const TechDocsAddons: React_2.ComponentType;
export const TechDocsAddons: React_2.ComponentType<
React_2.PropsWithChildren<{}>
>;
// @public
export interface TechDocsApi {
+6 -2
View File
@@ -43,7 +43,9 @@ export const TECHDOCS_ADDONS_WRAPPER_KEY = 'techdocs.addons.wrapper.v1';
* TechDocs Addon registry.
* @public
*/
export const TechDocsAddons: React.ComponentType = () => null;
export const TechDocsAddons: React.ComponentType<
React.PropsWithChildren<{}>
> = () => null;
attachComponentData(TechDocsAddons, TECHDOCS_ADDONS_WRAPPER_KEY, true);
@@ -71,7 +73,9 @@ export function createTechDocsAddonExtension<TComponentProps>(
* Create a TechDocs addon implementation.
* @public
*/
export function createTechDocsAddonExtension<TComponentProps>(
export function createTechDocsAddonExtension<
TComponentProps extends React.PropsWithChildren<{}>,
>(
options: TechDocsAddonOptions<TComponentProps>,
): Extension<(props: TComponentProps) => JSX.Element | null> {
const { name, component: TechDocsAddon } = options;