TypeScript TS7053: string cannot index a defined object
Reading translations[key] does not go compilation when key has a string type and object only finished keys. Any string does not need to be allowed to be the map key, so TypeScript blocks unverified reading.
How to identify the source of the problem
Compare key type and keyof typeof translations and where the key from the route parameter comes from. Check whether the set of allowed values is actually closed or to be an open dictionary.
Compare the message from the console with the result of the production compilation and the condition after the page has been refreshed.
Repair steps
Narrow key to keyof typeof translations after validation of the input or apply type guard to check the presence of the key. For really dynamic maps, declare Record<string,T> and predicted fallback at missing key.
How to Test Solution
The compiler accepts reading and the unknown parameter does not lead to undefined rendering.
Security and restrictions
Do not project unverified URL to keyof just to mute the error.