Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect typedefinition for TranslationStrings (fix suggested) #3032

Open
huineng opened this issue Oct 22, 2024 · 1 comment · May be fixed by #3077
Open

incorrect typedefinition for TranslationStrings (fix suggested) #3032

huineng opened this issue Oct 22, 2024 · 1 comment · May be fixed by #3077

Comments

@huineng
Copy link

huineng commented Oct 22, 2024

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 klaascuvelier linked a pull request Nov 28, 2024 that will close this issue
@klaascuvelier
Copy link
Contributor

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants