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.m.Select.getSelectedIndex` has no declaration #364

Closed sap-sebelao closed 2 years ago

sap-sebelao commented 2 years ago

Example:

import Select from "sap/m/Select";

let select = new Select();
select.getSelectedIndex(); // TS: Property 'getSelectedIndex' does not exist on type 'Select'.

I looked into the SDK and it does not seem to be part of the documentation either - which would point to the fact that this is not a public method, however I looked directly into the source of truth - the sap.m.Select code itself, and there is no @private tag:

/**
 * Retrieves the index of the selected item from the aggregation named <code>items</code>.
 *
 * @returns {int} An integer specifying the selected index, or -1 if no item is selected.
 * @since 1.26.0
*/
Select.prototype.getSelectedIndex = function() {
    var oSelectedItem = this.getSelectedItem();
    return oSelectedItem ? this.indexOfItem(this.getSelectedItem()) : -1;
};

So this seems strange, it's JSDoc does not seem to imply that this method is private, but it does not show up in SDK and the generated .d.ts anyway.

codeworrior commented 2 years ago

In general, the default visibility (when not specified) in SAPUI5 code is @private, not @public. This is to avoid that a developer accidentally makes a new method public (and thereby subject to our compatibility rules).

In the special case of sap.m.Select#getSelectedIndex and its neighbours, I wonder however, if the current status is intentional.

Would you mind to open an issue in SAP/openui5, asking the same?

codeworrior commented 2 years ago

Or, @kineticjs and @jdichev can you please take a look or forward accordingly?

kineticjs commented 2 years ago

Hello @sap-sebelao , Thank you for sharing this UI5 code related finding. We've created an internal incident 2280121286 to investigate it further. Regards, Diana

plamenivanov91 commented 2 years ago

Hello @sap-sebelao ,

The method in question is not related to a public property and it's meant to be used internally, we marked it as private.

Regards, Plamen