Code Monkey home page Code Monkey logo

Comments (3)

akudev avatar akudev commented on May 27, 2024

Hi Wouter,

you mean types for previous UI5 versions? There is definitely a difference - we have invested quite some time to improve the type definitions and the new ones are for writing UI5 code that uses ES modules. I'm unsure whether we can provide the "new" type definitions also for older UI5 versions. We have also done a lot of fixes/improvements in UI5 itself to make the generated type definitions error-free and "good". We can't downport all those changes. We could look into what happens when we just run the generator on an older version of UI5 and how the result looks. There will be errors, but most of them don't actually prevent the usage of the definition files (those few that do can probably be fixed). So maybe an unsupported one-time drop for select long-term-maintenance releases MIGHT be an option to look into after UI5con, but more than that most probably not.

In your second question, you mean the last part of

const AppController = Controller.extend("ui5.typescript.helloworld.controller.AppController", {

, right? It should just be controller.App. This looks fishy indeed.
It will still work because the file name matches the controller name in the View, so the correct file is loaded. And I guess once the controller was loaded, nobody cares about the name it gave to itself. But for instantiating manually one would have the wrong longer name with appended "Controller":

image

It seems like the code transformer uses the class name given here:
https://github.com/SAP-samples/ui5-cap-event-app/blob/typescript/packages/ui-form/src/controller/App.controller.ts#L7

Probably we should rename the class name here to avoid this odd situation. But one has to take care to avoid name clashes in such a case, e.g. with the sap.m.App control type. Let's keep this issue report open to follow up.

Regards
Andreas

from ui5-cap-event-app.

lemaiwo avatar lemaiwo commented on May 27, 2024

Thank you Andreas!

The reason I'm asking about the different TS types for different UI5 versions is because I found a difference for the "navTo" function.

We are using UI5 1.71 which has different params for the "navTo" function:
https://ui5.sap.com/1.71.38/#/api/sap.ui.core.routing.Router/methods/navTo
version 1.90:
https://ui5.sap.com/#/api/sap.ui.core.routing.Router%23methods/navTo

In vscode, this gives me an error on the "navTo" function while I'm using it in the correct way.
image

I guess it wouldn't harm to generate it for each version to cover these kind of differences.

Regarding the name, that means that renaming the names in TS without "Controller" would be fine?

Kr, Wouter

from ui5-cap-event-app.

akudev avatar akudev commented on May 27, 2024

Hi,
just noticed this now, way later, but we talked in the meantime, anyway. :-)
For sake of completeness: yes, renaming without "Controller" would be fine.
And no, we can't generate the TS interfaces for older versions of UI5, as there are also changes in the UI5 code required, not only in the generator, to get to a good result. Hence it would be dishonest to keep this issue report open, pretending that it will be done, sorry.
Once we - finally - publish the new version of the dts generator, anyone can try building the definitions for older versions on their own, but they will contain issues.

Regards
Andreas

from ui5-cap-event-app.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.