# generaltranslation: General Translation Core SDK: TranslationResult URL: https://generaltranslation.com/en-US/docs/core/types/translation-result.mdx --- title: TranslationResult description: Type definition for translation results returned by translate() methods --- ## Overview `TranslationResult` represents the result of translation operations. ```typescript type TranslationResult = RequestSuccess | TranslationError; ``` ## Union types ### RequestSuccess ```typescript type RequestSuccess = TypedResult & { success: true; locale: string; }; ``` ### TranslationError ```typescript type TranslationError = { success: false; error: string; code: number; }; ``` ## Examples ### Basic error handling ```typescript copy import { GT, TranslationResult } from 'generaltranslation'; const gt = new GT({ apiKey: 'your-api-key' }); const result: TranslationResult = await gt.translate('Hello'); if (result.success) { console.log(`Translation: ${result.translation}`); } else { console.error(`Translation failed: ${result.error}`); } ``` ### Using the discriminant ```typescript copy if (result.success) { // Handle success — result.translation is available } else { // Handle error — result.error and result.code are available } ``` ## Related types * [`TranslateManyResult`](/docs/core/types/translate-many-result) - Batch translation results