SAP / ui5-typescript

Tooling to enable TypeScript support in SAPUI5/OpenUI5 projects
https://sap.github.io/ui5-typescript
Apache License 2.0
201 stars 28 forks source link

`sap.fe.core.AppComponent` borked in 1.102.1? #358

Closed jakubledl closed 2 years ago

jakubledl commented 2 years ago

I'm currently updating an application from 1.96.7 to 1.102.1. We had the following code in our Component.ts:

import AppComponent from 'sap/fe/core/AppComponent';

export default class Component extends AppComponent {
  ...
}

This now fails with Module '"sap/fe/core/AppComponent"' has no default export. Looking into sap.fe.core.d.ts, sure enough, the module now looks like this:

declare module "sap/fe/core/AppComponent" {
  import { $UIComponentSettings } from "sap/ui/core/UIComponent";

  export interface $AppComponentSettings extends $UIComponentSettings {}
}

and AppComponent itself is declared a bit further down like this:

declare namespace sap
  namespace fe {
    namespace core {
      ...
      class AppComponent /* was: sap.ui.core.UIComponent */ extends Object {
        constructor();
      }
    }
  }
}

So of course, import AppComponent = sap.fe.core.AppComponent works, but then I get e.g. Property 'init' does not exist on type 'AppComponent'. Am I missing something here? 🙂

I'm using @sapui5/ts-types-esm@1.102.1.

nlunets commented 2 years ago

HI @jakubledl this is indeed borked since a few version when we completely switched those class to TS internally (talk about ironic).

Anyway, i've produced a fix now which should be included in the next release of the ui5 types. Do you need it specifically for 1.102 ? in which case i'd downport the fix there too.

jakubledl commented 2 years ago

Hi @nlunets, thanks for the reply. If it would be possible to downport the fix to 1.102, it would be great; we're bound to a central UI5 upgrage schedule, so the next update opportunity for us won't be coming for several months. Many thanks!

akudev commented 2 years ago

Because I just noticed: the 1.102 downport was merged yesterday, so this should be fixed in the next 1.102 SAPUI5 types patch (1.102.3).

akudev commented 2 years ago

I verified the issue is fixed in the latest 1.102 patches.

However it looks like the class is completely undefined in 1.104! The sap.fe library does its own thing (is actually already already converted to TypeScript), so this issue is probably not related to the type definition builder here, but I have reported this internally.

akudev commented 2 years ago

Alright: the complete lack of this class (and maybe others in sap.fe) was only in 1.103 and 1.104.0. It is fixed from 1.104.1 and a known issue in 1.105 is also going to be fixed, so essentially this is working fine in the latest release and is going to remain fine in subsequent ones.