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

`hasPopin` does not exist on type `Table` #366

Closed dfenerski closed 2 years ago

dfenerski commented 2 years ago

Are only the public methods exposed? sap.m.Table has a method called hasPopin: image but the typedefs throw an error: image

My version is 1.96, the latest LTM

codeworrior commented 2 years ago

Well, the generator exposes @public and @protected methods the same way.

Therefore, your finding puzzled me a while, until I noticed that the 1st screenshot does not show a JSDoc comment, only a simple block comment which is not evaluated as documentation.

This looks quite unintentional and I'll let the developers of the sap.m.Table control know.

akudev commented 2 years ago

Answer from the Table colleagues: those methods are only meant for internal use between related controls. They are planned to be marked as @ui5-restricted, which means they will continue not to be visible in the SDK API documentation and continue not to be meant for use in e.g. applications. So I'm closing this issue.

The topic how "internal" usages of restricted APIs with TypeScript can be supported is generally an open question. Some APIs are restricted to related controls, others to specific stakeholders (which can be informed in case of breaking changes) etc. Of course they need the types defined to easily use them, but on the other hand we cannot produce tailored type definitions for each different group of such internal users. Right now a way out is to define the needed types on top on side of the users.

dfenerski commented 2 years ago

It would be nice to clarify what is meant with "those methods" ... The JSDoc comment says the scope is @protected and IMO the predicate hasPopin has nothing internal and private about it, it's a common use case to want to know whether the items have transitioned.

codeworrior commented 2 years ago

"those methods" are the ones in sap/m/Table.js marked as @protected and with a simple (non-JSDoc) comment.

I agree that the hasPopin doesn't look very secret or implementation specific (which made me initially think that it was unintentionally kept private). But it's a design decision of the control owners what they expose as API or not.

@simlin maybe one of you wants to comment on the very special case of hasPopin.

simlin commented 2 years ago

Hi @dfenerski , in case you are interested in the state of the popin you most probably also need to be informed when this state is changed. So I think the popinChanged evet offers all the necessary information: https://sapui5.hana.ondemand.com/#/api/sap.m.Table%23events/popinChanged