From 06274a0a71092026b61d4cf764a0b84bbcf9bc97 Mon Sep 17 00:00:00 2001 From: TeamworkGuy2 Date: Sat, 22 Aug 2015 18:51:52 +0000 Subject: [PATCH] Added type definition for translate() 'options' parameter based on the source code from https://github.com/jamuhl/i18next/ --- i18next/i18next.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/i18next/i18next.d.ts b/i18next/i18next.d.ts index 060335af0..feb6658c8 100644 --- a/i18next/i18next.d.ts +++ b/i18next/i18next.d.ts @@ -17,6 +17,10 @@ interface IResourceStoreKey { [key: string]: any; } +interface I18nTranslateOptions extends I18nextOptions { + defaultValue?: any; // normally a string +} + interface I18nextOptions { lng?: string; // Default value: undefined load?: string; // Default value: 'all' @@ -108,8 +112,8 @@ interface I18nextStatic { load: (languages: string[], options: I18nextOptions, callback: (err: Error, store: IResourceStore) => void ) => void; postMissing: (language: string, namespace: string, key: string, defaultValue: any, languages: string[]) => void; }; - t(key: string, options?: any): string; - translate(key: string, options?: any): string; + t(key: string, options?: I18nTranslateOptions): string; + translate(key: string, options?: I18nTranslateOptions): string; exists(key: string, options?: any): boolean; }