carbon-design-system / carbon-components-angular

An Angular implementation of the Carbon Design System for IBM.
https://angular.carbondesignsystem.com
Apache License 2.0
535 stars 309 forks source link

incorrect typedefinition for TranslationStrings (fix suggested) #3032

Open huineng opened 1 month ago

huineng commented 1 month ago

This is an incorrect type definition for TranslationStrings

https://github.com/carbon-design-system/carbon-components-angular/blob/7967695ff011a0e42761f4fcf766820bdd2e1bef/src/i18n/i18n.service.ts#L138C1-L138C60

it should in fact support nested values like in the en.ts file

i suggest to modify it to

export type TranslationStrings = {
  [key: string]: string | { [key: string]: string | TranslationStrings };
};

Thanks

latest carbon-angular-components. version

klaascuvelier commented 19 hours ago

I think you are correct, but I think your suggestion can be simplified to

export type TranslationStrings = {
  [key: string]: string | TranslationStrings;
};

I created a PR where I updated the type :)