-
Notifications
You must be signed in to change notification settings - Fork 27
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
Types within @sapui5/ts-types are invalid #215
Comments
Hello @stnmtz The signatures are created from UI5 SDK metadata files (created from UI5 source code) in the UI5 build process. This metadata is manually created by humans and includes errors, unfortunately, not all of these issues The workaround is to |
@bd82 Thank you for the reply. I so far wasn't aware of Doesn't non-compileable types result in subsequent errors whenever one uses UI5 typings? For example, the code completion tools might work for some classes on some versions, but not with another class or another version of the typings. As the type for IFormContent@1.84.4 doesn't compile, I guess all the code completions for controls might be broken, and so on... As far as I understood, it would be better to publish a UI5 types version without compiler errors (but maybe with outdated types) than a non-compileable UI5 types version with up-to-date types. |
We're still in the process of defining the mapping from UI5 APIs to TypeScript. Not all compile errors that you see are "errors" in our metadata. Most Once we're done with the conceptual work for the mapping, we'll adapt the generation and clean-up issues in the sources, or, where this is not possible due to compatibility constraints in UI5, will exclude the corresponding APIs from the ts-types generation. From that point in time on, new errors will break our builds and won't go "unnoticed" (we already check the results at build time, but don't break the build yet). I know this isn't perfect but a) do we currently mainly target the language server b) do we work on a better solution and c) a possible workaround exists with We'll nevertheless discuss whether we'll go the extra mile to exclude all erroneous APIs for now. |
Thank you both for the feedback. I am aware of the Beta State, nevertheless is publishing non-compiling code a big question mark for me - no matter if the code completion plugins ignore those errors and try their best to make senseful annotations :) But maybe my understanding of Beta is just different. I opened the bug as there is a "test" script within the project which seems to be never called. We can close the issue imo. Nevertheless, I'd like to emphasize a bit on my use case which might help for the discussion: We have a whole lot of TypeScript libraries (based on modules) which we'd like to embed into UI5 applications. Of course, we'd like to use the CodeCompletion and sanity checks of TypeScript also within the UI5 (JavaScript) projects for those libraries. These JS projects are build with the UI5 tooling. Additionally, we'd like to use TypeScript to develop (Control-)Libraries augmenting UI5. These TypeScript-only libraries can then be compiled to JS and used in any UI5 application. Of course, for these libraries we have to ensure manually that all the required UI5 controls are loaded upfront in the application before they are used/extended in the library (no UI5 tooling here). We now have a working project with UI5 types and external module-based TypeScript libraries (compiled to JS), but we had to apply changes to the UI5 type definitions, as well as fine tune the tsconfig properties for UI5, which is usually not neccessary for published types. This configuration even works without the use of |
Hello @stnmtz I agree that producing type signatures that contain compilation errors is a bit strange. Also note that this project only contains the signature generator, this generator is later consumed by UI5 build process to create Regarding your scenario, I cannot really comment as I am not that deeply familiar with UI5 myself. |
Slightly OT: Triggered by this issue, I have taken a fresh look at the It seems that TypeScript no longer runs into such weak type detection issues when the interface inherits from a suitable base class. This would be an acceptable change on UI5 side as all But unfortunately, the current version of the dts-generator ignores the @bd82 I created #217 to allow this, can you please take a look? |
@codeworrior I reviewed #217 |
Hi,
I wanted to try out TypeScript and UI5 but so far was not able to compile my projects due to 76 type errors of the @sapui5/ts-types module. Thought the problem is on my end, but so far it seems that types inside the @sapui5/ts-types are wrong? I tested with @sapui5/ts-types versions 1.84.4 (76 errors), 1.85.2 (80 errors) and 1.78.17 (2 errors). I didn't test more versions, but it seems the tests are never quite run before publishing the modules?
Even if I run the
test
script ofnode_modules/@sapui5/ts-types
module, I get the same errors: Can somebody tell me what's up? Do I need more dependencies or are the type definition files really that buggy? Is there a types version which work?Cheers
The text was updated successfully, but these errors were encountered: