Clean up createTechDocsAddonExtension return type

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2022-04-25 15:10:00 +02:00
parent 736913517a
commit 075a9a067b
4 changed files with 9 additions and 5 deletions
@@ -0,0 +1,5 @@
---
'@backstage/plugin-techdocs-react': patch
---
Updated the return type of `createTechDocsAddonExtension` to better reflect the fact that passing children to Addon components is not a valid use-case.
@@ -6,10 +6,9 @@
/// <reference types="react" />
import { BackstagePlugin } from '@backstage/core-plugin-api';
import { ComponentType } from 'react';
// @public
export const ReportIssue: ComponentType<ReportIssueProps>;
export const ReportIssue: (props: ReportIssueProps) => JSX.Element | null;
// @public (undocumented)
export type ReportIssueProps = {
+1 -1
View File
@@ -17,7 +17,7 @@ import { SetStateAction } from 'react';
// @alpha
export function createTechDocsAddonExtension<TComponentProps>(
options: TechDocsAddonOptions<TComponentProps>,
): Extension<ComponentType<TComponentProps>>;
): Extension<(props: TComponentProps) => JSX.Element | null>;
// @alpha (undocumented)
export const defaultTechDocsReaderPageValue: TechDocsReaderPageValue;
+2 -2
View File
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { ComponentType, useCallback } from 'react';
import React, { useCallback } from 'react';
import { useOutlet } from 'react-router-dom';
import {
@@ -53,7 +53,7 @@ const getDataKeyByName = (name: string) => {
*/
export function createTechDocsAddonExtension<TComponentProps>(
options: TechDocsAddonOptions<TComponentProps>,
): Extension<ComponentType<TComponentProps>> {
): Extension<(props: TComponentProps) => JSX.Element | null> {
const { name, component: TechDocsAddon } = options;
return createReactExtension({
name,