From fce71d22fda90dc1596cf03b4ec8b87edd9c0d97 Mon Sep 17 00:00:00 2001 From: ParvinEyvazov Date: Tue, 8 Oct 2024 20:57:36 +0400 Subject: [PATCH] fix: solve lin & build err & version update --- package.json | 2 +- src/index.ts | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 55fd8fd..29fe9b4 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "3.2.0", + "version": "3.2.1", "license": "MIT", "main": "dist/index.js", "description": "Translate your JSON file or object into another languages with Google Translate API", diff --git a/src/index.ts b/src/index.ts index ebd2987..68d7bfe 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,15 +3,15 @@ import { plaintranslate } from './core/translator'; import { fileTranslator } from './core/json_file'; import { objectTranslator } from './core/json_object'; import { - TranslationConfig, - TranslationModules, + TranslationConfig as TranslationConfigTemp, + TranslationModules as TranslationModulesTemp, TranslationModule, } from './modules/modules'; import { default_concurrency_limit, default_fallback } from './utils/micro'; -const defaults: TranslationConfig = { +const defaults: TranslationConfigTemp = { moduleKey: 'google', - TranslationModule: TranslationModules['google'], + TranslationModule: TranslationModulesTemp['google'], concurrencyLimit: default_concurrency_limit, fallback: default_fallback, }; @@ -20,15 +20,16 @@ export async function translateWord( word: string, from: string, to: string, - config: TranslationConfig = defaults + config: TranslationConfigTemp = defaults ) { return await plaintranslate(config, word, from, to, []); } + export async function translateObject( object: translatedObject, from: string, to: string[], - config: TranslationConfig = defaults + config: TranslationConfigTemp = defaults ): Promise { let hard_copy = JSON.parse(JSON.stringify(object)); return objectTranslator(config, hard_copy, from, to); @@ -39,7 +40,7 @@ export async function translateFile( from: string, to: string[], newFileName: string, - config: TranslationConfig = defaults + config: TranslationConfigTemp = defaults ) { return fileTranslator(config, objectPath, from, to, newFileName); } @@ -53,6 +54,6 @@ export interface translatedObject { [key: string]: any; } -export { TranslationModules }; - -export type { TranslationConfig, TranslationModule }; +export { TranslationModule }; +export type TranslationModules = TranslationModulesTemp; +export type TranslationConfig = TranslationConfigTemp;