-
-
Notifications
You must be signed in to change notification settings - Fork 593
Open
Labels
Description
According to the lines below, the any union is necessary.
core/projects/ngx-translate/src/lib/translate.service.ts
Lines 19 to 26 in ee77f16
| export type Translation = | |
| string | | |
| Translation[] | | |
| TranslationObject | | |
| // required to prevent error "Type instantiation is excessively deep and possibly infinite." | |
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | |
| any |
However, this causes me issues, since the type of Translation is any because any overrides everything.
So I tried this in my local repo ("typescript": "^5.4.5") and I get no such recursion message.
// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
interface TranslationObject {
[key: string]: Translation;
}
type Translation = string | Translation[] | TranslationObject;I can think of two possible causes (but there might be another reason):
- When this code was written, that restriction was in place, but it was removed in a later Typescript version.
- When this code was written, the restriction was detected, and circumvented by making
TranslationObjectan interface. However the| anywas not removed by accident.
Can this | any be removed?
SvajkaJ, AlenRedek, JensOlesen47, json-derulo, rbalet and 2 more