Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
feat: add typing for importer errors
Andrew Bastine9e791ce9069
diff --git a/packages/hoppscotch-app/helpers/import-export/import/index.ts b/packages/hoppscotch-app/helpers/import-export/import/index.tsindex 002fa7cc6..ec6ce751a 100644--- a/packages/hoppscotch-app/helpers/import-export/import/index.ts+++ b/packages/hoppscotch-app/helpers/import-export/import/index.ts@@ -2,21 +2,21 @@ import * as TE from "fp-ts/TaskEither"import { StepsOutputList } from "../steps"/**- * The error state to be used when the file formats do not match+ * A common error state to be used when the file formats are not expected*/export const IMPORTER_INVALID_FILE_FORMAT ="importer_invalid_file_format" as constexport type HoppImporterError = typeof IMPORTER_INVALID_FILE_FORMAT-type HoppImporter<T, StepsType> = (+type HoppImporter<T, StepsType, Errors> = (stepValues: StepsOutputList<StepsType>-) => TE.TaskEither<HoppImporterError, T>+) => TE.TaskEither<Errors, T>/*** Definition for importers*/-type HoppImporterDefintion<T, Y> = {+type HoppImporterDefintion<T, Y, E> = {/*** Name of the importer, shown on the Select Importer dropdown*/@@ -25,7 +25,7 @@ type HoppImporterDefintion<T, Y> = {/*** The importer function, It is a Promise because its supposed to be loaded in lazily (dynamic imports ?)*/- importer: HoppImporter<T, Y>+ importer: HoppImporter<T, Y, E>/*** The steps to fetch information required to run an importer@@ -36,12 +36,12 @@ type HoppImporterDefintion<T, Y> = {/*** Defines a Hoppscotch importer*/-export const defineImporter = <ReturnType, StepType>(input: {+export const defineImporter = <ReturnType, StepType, Errors>(input: {name: string- importer: HoppImporter<ReturnType, StepType>+ importer: HoppImporter<ReturnType, StepType, Errors>steps: StepType}) => {- return <HoppImporterDefintion<ReturnType, StepType>>{+ return <HoppImporterDefintion<ReturnType, StepType, Errors>>{...input,}}