Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ts-interface-generator): add types for event parameters and events
Event parameters of controls etc. are now available as types named like "<ControlName>$<EventName>EventParameters" and the events themselves as "<ControlName>$<EventName>Event". The respective event-related methods make use of these events, so for consumers there is now full type support regarding the events of controls developed with this interface-generator. ONE CAVEAT: The generated types make use of the fact that sap.ui.base.Event is a class with generics since version 1.115 of the UI5 types. For use with lower versions of the UI5 types, the generator can create a kind of shim that makes the Event class generic. This happens automatically based on the version of the UI5 types AT CONTROL DEVELOPMENT TIME (i.e. only when the control developer uses a version of the UI5 types lower than 1.115). If, however, the application developer USING the control uses a different version of the UI5 types than the control developer, then the following happens: 1.) App uses >=1.115, Control uses < 1.115: the shim is there but does not hurt. 2.) App uses <1.115, Control uses >= 1.115: the shim is missing and the generated *.gen.d.ts file is not valid in the context of the app's UI5 types. However, TypeScript simply makes the type "any", so there there is no big problem on application side, only reduced type safety. Furthermore, "skipLibCheck" needs to be set to "true", otherwise the TypeScript compiler reports an error when checking the UI5 types and the generated interface files. Tested to work in TS 4.7 (at least) up to 5.1. fix #399
- Loading branch information