From f93755604a6b48782401724b5d9e782c23802ac4 Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Thu, 30 Nov 2023 00:13:10 +0100 Subject: [PATCH] Improve esm compatability --- src/targets/typescript.ts | 4 ++-- templates/ts_base.ts | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/targets/typescript.ts b/src/targets/typescript.ts index 761dc6f..bf256f2 100644 --- a/src/targets/typescript.ts +++ b/src/targets/typescript.ts @@ -33,7 +33,7 @@ export class TypescriptTarget extends CompileTarget { } private generateImport(imports: string, path: string) { - return `import ${imports} from "${path + (this.flavour === "esm" ? ".ts" : "") + return `import ${imports} from "${path + (this.flavour === "esm" ? ".js" : "") }";\n`; } @@ -207,7 +207,7 @@ export class TypescriptTarget extends CompileTarget { this.writeFormattedFile( "service_client.ts", this.generateImport( - "{ RequestObject, ResponseObject, ErrorCodes, Logging }", + "{ type RequestObject, type ResponseObject, ErrorCodes, Logging }", "./service_base" ) + this.generateImport(" { VerificationError }", "./ts_base") + diff --git a/templates/ts_base.ts b/templates/ts_base.ts index b3b9e3f..d296810 100644 --- a/templates/ts_base.ts +++ b/templates/ts_base.ts @@ -1,5 +1,3 @@ -import { isGeneratorFunction } from "util/types"; - function form_verficiation_error_message(type?: string, field?: string) { let msg = "Parameter verification failed! "; if (type && field) {