From 08b075b00a4e7927559940b30984925abb33b489 Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Mon, 3 Jul 2023 15:40:10 +0530 Subject: [PATCH] catalog-import: use type locally Signed-off-by: Himanshu Mishra --- plugins/catalog-import/api-report.md | 7 +++++-- .../StepFinishImportLocation.tsx | 12 +++++------- .../catalog-import/src/components/useImportState.ts | 12 +++++------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/plugins/catalog-import/api-report.md b/plugins/catalog-import/api-report.md index 7fd3bd9dd6..b4c8e854aa 100644 --- a/plugins/catalog-import/api-report.md +++ b/plugins/catalog-import/api-report.md @@ -244,7 +244,11 @@ export type PreparePullRequestFormProps< export type PrepareResult = | { type: 'locations'; - locations: NewLocations; + locations: Array<{ + exists?: boolean; + target: string; + entities: CompoundEntityRef[]; + }>; } | { type: 'repository'; @@ -360,5 +364,4 @@ export interface StepPrepareCreatePullRequestProps { // Warnings were encountered during analysis: // // src/api/CatalogImportApi.d.ts:25:5 - (ae-forgotten-export) The symbol "PartialEntity" needs to be exported by the entry point index.d.ts -// src/components/useImportState.d.ts:21:5 - (ae-forgotten-export) The symbol "NewLocations" needs to be exported by the entry point index.d.ts ``` diff --git a/plugins/catalog-import/src/components/StepFinishImportLocation/StepFinishImportLocation.tsx b/plugins/catalog-import/src/components/StepFinishImportLocation/StepFinishImportLocation.tsx index 1d566253c3..38372e59ba 100644 --- a/plugins/catalog-import/src/components/StepFinishImportLocation/StepFinishImportLocation.tsx +++ b/plugins/catalog-import/src/components/StepFinishImportLocation/StepFinishImportLocation.tsx @@ -31,15 +31,13 @@ type Props = { onReset: () => void; }; -type NewLocations = Array<{ - exists?: boolean; - target: string; - entities: CompoundEntityRef[]; -}>; - // Among the newly registered entities, return a software entity (e.g. Component, API, Resource) const filterComponentEntity = ( - newLocations: NewLocations, + newLocations: Array<{ + exists?: boolean; + target: string; + entities: CompoundEntityRef[]; + }>, ): CompoundEntityRef | null => { for (const location of newLocations) { for (const entity of location.entities) { diff --git a/plugins/catalog-import/src/components/useImportState.ts b/plugins/catalog-import/src/components/useImportState.ts index 01649d5edb..965f855f30 100644 --- a/plugins/catalog-import/src/components/useImportState.ts +++ b/plugins/catalog-import/src/components/useImportState.ts @@ -32,12 +32,6 @@ export type ImportFlows = // the available states of the stepper type ImportStateTypes = 'analyze' | 'prepare' | 'review' | 'finish'; -type NewLocations = Array<{ - exists?: boolean; - target: string; - entities: CompoundEntityRef[]; -}>; - /** * Result of the prepare state. * @@ -46,7 +40,11 @@ type NewLocations = Array<{ export type PrepareResult = | { type: 'locations'; - locations: NewLocations; + locations: Array<{ + exists?: boolean; + target: string; + entities: CompoundEntityRef[]; + }>; } | { type: 'repository';