Closed 2028942481 closed 11 months ago
Hi @2028942481,
thanks for reporting. We used to have our own typing the I18nBundle, but since the UI5 Web Components migrated to TypeScript as well, we're now reusing their types, so this issue needs to fixed in the UI5 Web Components Repository. I'll forward this issue accordingly.
Hi colleagues,
the documentation says that the I18nBundle.getText method can be called with both the object containing the I18n-key and default translation as well as with a string. The currently used type prohibits that. I would recommend to change the following line to getText(textObj: I18nText | string, ...params: Array<number | string>): string {
:
Describe the bug
Hello, we are using ui5 for front-end development. The previous version we used was:
"@ui5/webcomponents": "^1.7.1", "@ui5/webcomponents-react": "^0.28.0"
Now you want to upgrade to:
"@ui5/webcomponents": "^1.15.0", "@ui5/webcomponents-react": "^1.17.0".
However, when we upgraded the version to the target version, the following issue occurred. Since we're using the TS language, it has strong type checking, but the interface to i18nBundle has changed in the updated version. Here is some of the code:
const i18nBundle = useI18nBundle('test'); message = i18nBundle.getText("TEST");
When TS compiles we get the following error:
“Argument of type 'string' is not assignable to parameter of type 'I18nText'.”
After checking the code, we find that in the file i18nBundle.d.ts, the getText method first receives arguments of type I18nText, which should also accept arguments of type string, otherwise the previous TS code will not work after updating the UI5 version. Please help us fix it, thank you.
Isolated Example
No response
Reproduction steps
1. 2. 3. ...
Expected Behaviour
No response
Screenshots or Videos
UI5 Web Components for React Version
1.17.0
UI5 Web Components Version
1.15.0
Browser
Chrome, Edge, Firefox, Safari
Operating System
No response
Additional Context
No response
Relevant log output
No response
Declaration