-
-
Notifications
You must be signed in to change notification settings - Fork 671
Description
💥 Regression Report
This isn't really a functional regression, more like a convenience regression, it only concerns the new Typescript enhancements.
When using the t function it is now impossible to use with keys that don't exist in the default namespace, even when a default value is provided, which it could fall back to.
This forces me to always add every key to my default namespace's resource file.
Usually in our workflow we only add translations inline using the defaultValue, when developing a new feature.
This is because things often change.
Only once something is production ready, we run i18next-parser to extract all keys and add translations.
Proposal
I propose to add additional overloads for when a default value is provided (one for t('key', 'defaultValue')
, one for t('key', { defaultValue: 'value' })
, where the key can be any string.
Last working version
Worked up to version: 21
Stopped working in version: 22
To Reproduce
Steps to reproduce the behavior:
t('unkown.key', 'default translation')
// ⬆ No overload matches this call.
// The last overload gave the following error.
// Argument of type '"unkown.key"' is not assignable to parameter of type 'Normalize<{ ... }> | TemplateStringsArray ...`
Your Environment
- runtime version: i.e. node v16
- i18next version: i.e. 22.0.5
- os: Mac