question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Properties not assignable in classes LightBox, UIArea and Table

See original GitHub issue

Using the @openui5/ts-types-esm@1.93.0 with Typescript version 4.5.0-dev.20210812 there are errors with the type definitions themselves when running tsc:

MARVIN:my_project me$ tsc
node_modules/@openui5/ts-types-esm/types/sap.m.d.ts:34236:5 - error TS2416: Property 'invalidate' in type 'LightBox' is not assignable to the same property in base type 'Control'.
  Type '(oOrigin: object) => this' is not assignable to type '(oOrigin?: ManagedObject | undefined) => void'.
    Types of parameters 'oOrigin' and 'oOrigin' are incompatible.
      Type 'ManagedObject | undefined' is not assignable to type 'object'.
        Type 'undefined' is not assignable to type 'object'.

34236     invalidate(
          ~~~~~~~~~~

node_modules/@openui5/ts-types-esm/types/sap.ui.core.d.ts:33085:5 - error TS2416: Property 'getBindingContext' in type 'UIArea' is not assignable to the same property in base type 'ManagedObject'.
  Type '() => null' is not assignable to type '(sModelName?: string | undefined) => Context'.
    Type 'null' is not assignable to type 'Context'.

33085     getBindingContext(): null;
          ~~~~~~~~~~~~~~~~~

node_modules/@openui5/ts-types-esm/types/sap.ui.core.d.ts:33107:5 - error TS2416: Property 'getId' in type 'UIArea' is not assignable to the same property in base type 'ManagedObject'.
  Type '() => string | null' is not assignable to type '() => string'.
    Type 'string | null' is not assignable to type 'string'.
      Type 'null' is not assignable to type 'string'.

33107     getId(): string | null;
          ~~~~~

node_modules/@openui5/ts-types-esm/types/sap.ui.table.d.ts:5582:5 - error TS2416: Property 'getDragDropConfig' in type 'Table' is not assignable to the same property in base type 'Control'.
  Type '() => undefined' is not assignable to type '() => DragDropBase[]'.
    Type 'undefined' is not assignable to type 'DragDropBase[]'.

5582     getDragDropConfig(): undefined;
         ~~~~~~~~~~~~~~~~~


Found 4 errors.

Installed packages:

@openui5/ts-types-esm@1.93.0
@types/jquery@3.5.6
@types/qunit@2.11.2

tsconfig.json:

{
	"compilerOptions": {
	...
		"types": ["@openui5/ts-types-esm", "@types/qunit", "jquery"],
	...
		"lib": ["dom","es7"]
	}
...
}

Typescript version:

MARVIN:my_project me$ tsc --version
Version 4.5.0-dev.20210812

The incompatible declarations can be patched so that they compile correctly:

diff --git a/node_modules/@openui5/ts-types-esm/types/sap.m.d.ts b/node_modules/@openui5/ts-types-esm/types/sap.m.d.ts
index 2d18654..da6cba2 100644
--- a/node_modules/@openui5/ts-types-esm/types/sap.m.d.ts
+++ b/node_modules/@openui5/ts-types-esm/types/sap.m.d.ts
@@ -34066,6 +34066,8 @@ declare module "sap/m/LightBox" {
 
   import ElementMetadata from "sap/ui/core/ElementMetadata";
 
+  import ManagedObject from "sap/ui/base/ManagedObject";
+
   /**
    * Represents a popup containing an image and a footer.
    *
@@ -34237,7 +34239,7 @@ declare module "sap/m/LightBox" {
       /**
        * Origin of the invalidation.
        */
-      oOrigin: object
+      oOrigin: ManagedObject
     ): this;
     /**
      * Returns if the LightBox is open.
diff --git a/node_modules/@openui5/ts-types-esm/types/sap.ui.core.d.ts b/node_modules/@openui5/ts-types-esm/types/sap.ui.core.d.ts
index 18d35fa..0e2dc1d 100644
--- a/node_modules/@openui5/ts-types-esm/types/sap.ui.core.d.ts
+++ b/node_modules/@openui5/ts-types-esm/types/sap.ui.core.d.ts
@@ -32980,6 +32980,8 @@ declare module "sap/ui/core/UIArea" {
 
   import Interface from "sap/ui/base/Interface";
 
+  import Context from "sap/ui/model/Context";
+
   /**
    * An area in a page that hosts a tree of UI elements.
    *
@@ -33082,7 +33084,7 @@ declare module "sap/ui/core/UIArea" {
     /**
      * Provide getBindingContext, as UIArea can be parent of an element.
      */
-    getBindingContext(): null;
+    getBindingContext(sModelName?: string): Context;
     /**
      * Gets content of aggregation {@link #getContent content}.
      *
@@ -33104,7 +33106,7 @@ declare module "sap/ui/core/UIArea" {
     /**
      * Returns this `UIArea`'s id (as determined from provided RootNode).
      */
-    getId(): string | null;
+    getId(): string;
     /**
      * @deprecated (since 1.1) - use function {@link #getContent} instead
      *
diff --git a/node_modules/@openui5/ts-types-esm/types/sap.ui.table.d.ts b/node_modules/@openui5/ts-types-esm/types/sap.ui.table.d.ts
index 198f825..687e4b3 100644
--- a/node_modules/@openui5/ts-types-esm/types/sap.ui.table.d.ts
+++ b/node_modules/@openui5/ts-types-esm/types/sap.ui.table.d.ts
@@ -3803,6 +3803,8 @@ declare module "sap/ui/table/Table" {
 
   import TooltipBase from "sap/ui/core/TooltipBase";
 
+  import DragDropBase from "sap/ui/core/dnd/DragDropBase";
+
   /**
    *  Provides a comprehensive set of features for displaying and dealing with vast amounts of data. The
    * Table control supports desktop PCs and tablet devices. On tablets, special consideration should be given
@@ -5579,7 +5581,7 @@ declare module "sap/ui/table/Table" {
      * 	 - Group header rows
      * 	 - Sum rows
      */
-    getDragDropConfig(): undefined;
+    getDragDropConfig(): DragDropBase[];
     /**
      * Gets current value of property {@link #getEditable editable}.
      *

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
akudevcommented, Aug 16, 2021

Another change fixed one of the UIArea issues: https://github.com/SAP/openui5/commit/ff2b05340eb90375c58bd5875e803e6cb19d8eae

In a further change, the d.ts generation will probably be configured to add a @ts-ignore for UIArea.getId().

Afterwards, the type definitions will be compatible with strictNullChecks:true.

Further changes will do the same for the full SAPUI5 type definitions and will make sure there are no regressions. Thanks for prompting us to improve this!

0reactions
akudevcommented, Jan 25, 2022

@one-github With the just published version 1.98.0, full strict mode should be working fine.

See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/58429

Read more comments on GitHub >

github_iconTop Results From Across the Web

Display | UI Element Types | SAP Fiori Design Guidelines
By default, the HTML content (property: content ) is not sanitized and is therefore open to XSS attacks. App teams must either sanitize...
Read more >
QUnit Page for UI5 controls
LightBox: TypeError: Cannot read properties of null (reading '_getNativeImage')@ 339 ms; Memory leak check for sap.m.
Read more >
Properties height and width of the control can be defined.
My goal with the ChoroplethMap control is to provide a reusable, mobile-ready and easy-to-use UI5 control (see image above) that handles common use-cases...
Read more >
https://raw.githubusercontent.com/lmcarreiro/ui5-t...
NOTE: This class is internal and all its functions must not be used by an ... the visibility property of the column *...
Read more >
Incident Response Report False-Positive
Not all malicious and suspicious indicators are displayed. Get your own cloud service or the full version to view all details.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found