In my quest to sync my Russian and English language dictionaries dynamically, I encounter a challenge.
Imagine having two objects:
const ru = {
'page.main.hello': 'Привет!'
}
const en = {
'page.main.hello': 'Hi!'
}
If I add a key to the "ru" object, I want TypeScript to automatically update the "en" object by adding the same key.
const ru = {
'page.main.hello': 'Привет!'
}
const en = {
'page.main.hello': 'Hi!',
'page.main.bye': 'Bye!'
}
The problem arises when typing errors occur as the key 'page.main.bye' does not exist in the "ru" dictionary.
I attempted using ru: keyof typeof en
and en: keyof typeof ru
, but due to self-reference, it proved ineffective.
Selecting a base object between the two is not a viable solution to the synced objects dilemma.