🐛 Bug Report
t function autocompletes with duplicate entries, both with and without namespace prefix. If I use the prefixed version, I get a TS error.
const { t } = useTranslation();
const foo = t('ABORT')
const foo = t('translation:ABORT')
First problem is that both of these shows up as suggestions. Second problem is that using the second version gives a TS error:
[tsserver 2769] [E] No overload matches this call.
Overload 1 of 12, '(key: Normalize<{ ABORT: string;....
To Reproduce
Set up TS as per preferred approach, with objects declared as const.
i18n.ts
import { initReactI18next } from 'react-i18next';
import i18n from 'i18next';
import sv from './../assets/locales/sv/translation.json';
export const defaultNS = 'translation';
export const resources = { sv: { translation: sv } } as const;
export const i18nConfig = i18n.use(initReactI18next).init({
lng: 'sv',
defaultNS,
resources,
});
Codesandbox:
22.4.5


Expected behavior
Suggestions should not show both unprefixed and prefixed.
No suggestion should give an error.
const { t } = useTranslation();
t('') // only "FOO" should show up as suggestion.
Your Environment
- runtime version: browser lastest chrome, node 16.15.1
- i18next version: 22.4.2 to 22.4.5
- os: Mac OS Monterey 12.2.1
🐛 Bug Report
tfunction autocompletes with duplicate entries, both with and without namespace prefix. If I use the prefixed version, I get a TS error.First problem is that both of these shows up as suggestions. Second problem is that using the second version gives a TS error:
To Reproduce
Set up TS as per preferred approach, with objects declared as const.
i18n.ts
Codesandbox:
22.4.5
Expected behavior
Suggestions should not show both unprefixed and prefixed.
No suggestion should give an error.
Your Environment