i18n format issue

Hello guys, I just updated to the newest version of i18n plugin. My format function is now throwing an error I cannot get much context out of: My code
geti18nLanguageString(key: string, customLanguage: Languages | string, guild?: Guild, options?: any): string {
let language = customLanguage;
if (guild !== undefined) {
language = guild.language.toString();
}
if (options) {
return container.i18n.format(language, key, options);
}
return container.i18n.format(language, key);
}
geti18nLanguageString(key: string, customLanguage: Languages | string, guild?: Guild, options?: any): string {
let language = customLanguage;
if (guild !== undefined) {
language = guild.language.toString();
}
if (options) {
return container.i18n.format(language, key, options);
}
return container.i18n.format(language, key);
}
The error occurrs on this line
return container.i18n.format(language, key, options);
return container.i18n.format(language, key, options);
TS2322: Type  string | TFunctionDetailedResult<string>  is not assignable to type  string 
Type  TFunctionDetailedResult<string>  is not assignable to type  string
TS2322: Type  string | TFunctionDetailedResult<string>  is not assignable to type  string 
Type  TFunctionDetailedResult<string>  is not assignable to type  string
The line right under it without options is not throwing an error. Has someone an idea what's the issue is about and how to fix it?
2 Replies
Favna
Favna10mo ago
container.i18n.format no longer exclusively returns a string because it can also return an object. Adjust the return type of your own wrapper function... Or don't use a wrapper function at all and just import and use resolveKey and implement fetchLamguage because that whole wrapper function becomes pointless if you do as you can already get the guild language in fetchLanguage pepeDaheck part of the breaking changes and "also see their upgrading guide"
ShowCast
ShowCast10mo ago
Ahh that was the point! Got you, thanks for the hint 😄