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 -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;