Merge pull request #11070 from backstage/techdocs/addon-extension-return-type
[TechDocs] Clean up extension creator return type
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/plugin-techdocs-react': patch
|
||||
'@backstage/plugin-techdocs-module-addons-contrib': 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 = {
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
"react-use": "^17.2.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "^16.13.1 || ^17.0.0",
|
||||
"react": "^16.13.1 || ^17.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -60,6 +59,7 @@
|
||||
"@testing-library/user-event": "^14.0.0",
|
||||
"@types/jest": "^26.0.7",
|
||||
"@types/node": "^16.11.26",
|
||||
"@types/react": "^16.13.1 || ^17.0.0",
|
||||
"msw": "^0.35.0",
|
||||
"cross-fetch": "^3.1.5"
|
||||
},
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user