-
-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript: can't pass default value to "t" as second argument #1198
Comments
@jamuhl are the docs wrong? I see i18next.t('key', {defaultValue: 'default value to show'}); but not: i18next.t('key', 'default value to show'); |
I don't spot the case where the string defaultValue as a second arg is allowed/tested in https://github.com/i18next/i18next/blob/master/test/translator/translator.translate.defaultValue.spec.js |
both is allowed...having second function argument a string it's used as defaultValue using https://github.com/i18next/i18next/blob/master/src/Translator.js#L66 which defaults to https://github.com/i18next/i18next/blob/master/src/defaults.js#L39 |
new tests do not yet cover all cases - that's the reason why we run the old compatibility tests... |
Using
t('key', 'Default value')
(as documented in https://www.i18next.com/translation-function/essentials#passing-a-default-value) currently causes the following error:Argument of type '"Default value"' is not assignable to parameter of type 'TOptions<object> | undefined'.
I'm using version 14.1.1
The text was updated successfully, but these errors were encountered: