chore: reworking these types a little bit now so that we can expose the uiSchema props in the api-report

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2022-02-23 08:31:47 +01:00
parent 7517c93c09
commit 61d091e705
2 changed files with 16 additions and 10 deletions
+6 -3
View File
@@ -25,9 +25,12 @@ import { Extension, attachComponentData } from '@backstage/core-plugin-api';
export const FIELD_EXTENSION_WRAPPER_KEY = 'scaffolder.extensions.wrapper.v1';
export const FIELD_EXTENSION_KEY = 'scaffolder.extensions.field.v1';
export function createScaffolderFieldExtension<TReturnValue = unknown>(
options: FieldExtensionOptions<TReturnValue>,
): Extension<() => null> {
export function createScaffolderFieldExtension<
TReturnValue = unknown,
TInputProps = unknown,
>(
options: FieldExtensionOptions<TReturnValue, TInputProps>,
): Extension<TInputProps> {
return {
expose() {
const FieldExtensionDataHolder: any = () => null;
+10 -7
View File
@@ -33,9 +33,12 @@ export type CustomFieldValidator<TReturnValue> = (
*
* @public
*/
export type FieldExtensionOptions<TReturnValue = unknown> = {
export type FieldExtensionOptions<
TReturnValue = unknown,
TProps = FieldProps<TReturnValue>,
> = {
name: string;
component: (props: FieldProps<TReturnValue>) => JSX.Element | null;
component: (props: TProps) => JSX.Element | null;
validation?: CustomFieldValidator<TReturnValue>;
};
@@ -46,10 +49,10 @@ export type FieldExtensionOptions<TReturnValue = unknown> = {
* @public
*/
export interface FieldExtensionComponentProps<
ReturnValue,
UiOptions extends {} = {},
> extends FieldProps<ReturnValue> {
uiSchema: {
'ui:options'?: UiOptions;
TReturnValue,
TUiOptions extends {} = {},
> extends FieldProps<TReturnValue> {
uiSchema: FieldProps['uiSchema'] & {
'ui:options'?: TUiOptions;
};
}