Closed EricVanEldik closed 1 year ago
Right, the solution involving UI5Event
may be unintuitive, as it is not clear where UI5Event
is supposed to come from - it should despite its name be imported from sap/ui/base/Event
. Sometimes we choose Names like UI5Element
and UI5Event
to prevent confusion with DOM Elements/Events, but of course they only work with the correct import.
Regarding the existing solution you tried, please check from which module you have imported Input$ChangeEventParameters
- I'm pretty sure it's from the web components library ("sap.ui.webc..."), while the Input you are using is a "sap.m.Input". The WebComponents Input has a "change" event with no parameters, hence the "never".
Try with "InputBase$ChangeEventParameters" and import { InputBase$ChangeEventParameters } from "sap/m/InputBase";
instead. The event is defined on this base class.
Or when using 1.115.1 or 1.116.0, you can directly use InputBase$ChangeEvent
instead of Event<InputBase$ChangeEventParameters>
.
I see the Input$ChangeEvent has also been mentioned in the release notes. https://github.com/SAP/ui5-typescript/commit/7d37027ac90a93cf393b6b00f00604368a1e77f9 fixes this and changes usages of UI5Event
to Event
, including the import now.
thank you, this solves it!
According to the release notes of 1.115.0 in https://sap.github.io/ui5-typescript/releasenotes.html
evt.getParameter("eventParamName");
now returns a typescript error:Argument of type 'string' is not assignable to parameter of type 'never'.ts(2345)
However the solution provided:
public handleChange(evt: UI5Event<$InputBaseChangeEventParameters>) : void { ... }
doesn't seem to work, because UI5Event is not defined as a type in"@sapui5/types": "^1.116.0"
I tried the following solution which does exists:
but still gives the type error:
Argument of type 'string' is not assignable to parameter of type 'never'.ts(2345)