"Unresolved variable or type…" using `@types/openui5`
See original GitHub issueOpenUI5 version: 1.97.0
In IDEA 2021.3, I’ve added @types/openui5
of 1.97.0
to the list of the JavaScript libraries.
I’ve checked the content of sap.ui.core.d.ts
, it does contain the definition of UIComponent
.
But at the same time, IDEA is not capable of resolving the sap.ui.core.UIComponent
:
I’ve opened a ticket at IDEA: https://youtrack.jetbrains.com/issue/WEB-52649, but would like to understand is it an IDEA issue or the @types/openui5
definitions one?
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
"Unresolved variable or type…" warning despite installed ...
Starting several recent builds, IDEA raises warning Unresolved variable or type '…' when using SAP OpenUI5 libraries. I've checked, @types/openui5 library ...
Read more >Webstorm + Flow + React: Unresolved variable or type $Keys
I've searched around in circles with no answer. I found one source saying "install flow globally instead", I tried that, but it didn't...
Read more >How I Fixed: unresolved variable or type await
Trying to use async / await in WebStorm but getting: "unresolved variable or type await"? These things are only easy if you know...
Read more >Webstorm adding script file to html page get unresolved ...
I'm getting unresolved variable or type error each time i tried to ... enter image description here ... Sign up using Email and...
Read more >ExtractVariables returns "Unresolved variable : ur... - Apigee
This website uses cookies from Google to deliver its services and to analyze traffic. Click Here to learn more. Accept · Reject.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ehm, do you remember? We tried that in the beginning, and it didn’t work out. Initially, this was our preferred approach over having two separate type worlds which can’t be mixed. If I remember it correctly, one of the problems was that the necessary imports are not allowed in ambient files (only in modules) and another one was the dual type-and-value nature of e.g. enums that we didn’t manage to re-export in namespaces. IIRC (2), there had been many discussion around similar topics in the web community and they all ended up in going either way (globals or modules).
Well, but if someone has a good proposal how to achieve this, I would be glad to give it a second try.
Hi @pubmikeb Have you had a look at https://github.com/SAP-samples/ui5-cap-event-app/blob/js-with-typescript-support/README.md? In particular this section: https://github.com/SAP-samples/ui5-cap-event-app/blob/js-with-typescript-support/README.md#provide-type-information-for-loaded-dependencies
The
@types/openui5
definitions do no longer support using global variables likesap.*
. This is to promote using modern JavaScript language features like ES modules in newly written TypeScript apps. For JavaScript coding supported by those type definitions this unfortunately means that the type references in JSDoc need to be written in a module import way as well, as explained in the last link above:Please try typing the function parameters in this way!
If, e.g. for existing applications, you still need to use the global names, you can try using the
@openui5/ts-types
package of type definitions. This flavor of the UI5 type definitions still supports the globals and should be equivalent to (actually better than) the prior@types/openui5
pakages. However, it’s not the flavor which is in our focus for the future, so switching over to the module way would be a good thing in new projects.Regards Andreas