You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which is quite cumbersome. The natural approach of typing action as MessageBox.Action does not seem to work, I get
Cannot access 'MessageBox.Action' because 'MessageBox' is a type, but not a namespace. Did you mean to retrieve the type of the property 'Action' in 'MessageBox' with 'MessageBox["Action"]'
in the second line work for you to have at least some simplification?
I think it should, as the keys (alternative proposal) equal the values (your code) in UI5 enums.
(Plus, of course there is the possibility to say MessageBox["Action"] as suggested in the error message.)
Hey @akudev, I noticed another thing I wanted to ask about. Tell me if I it does not belong here - It's not directly related to this issue.
During development, I've noticed the JQuery.Event is not generic:
This forces type casting when retrieving the "parameters" of the event - in this case the theme. It's not real parameters, its assigned to the object itself and also its not real event, its a jQuery one & with future removal intent of the lib IDK if it's worth a discussion.
Hello everyone, I just upgraded to this package and I'm having the same issue to import the Action enum from the MessageBox. I know that in older packages of the type declarations the enums were exported with the controls, is there a reason why this was changed for this package?
True, but it's defined by jQuery, not by us. We could probably extend it, but yeah, not really investing into jQuery anymore.
Plus, I wonder how you got to use JQuery.Event in this place. Your onThemeChanged is a handler registered via the Core's attachThemeChanged? But it passes a sap.ui.base.Event, not a jQuery one.
You could reply: "Ha! Why is it not generic, then?". Well, the reason why this event (and IIRC half a dozen others) are not generic is because how we did it was generically making them generic in the dts generator, but this covered only events fired by classes inheriting from EventProvider. Core isn't one, but does the eventing manually.
We still could make it generic, but attachThemeChanged is deprecated now and its replacement Theming.attachApplied(...) does have a typed event:
Again, Theming is not an event provider, hence the typing was done manually and it seems the parameters are directly on the event instead of accessible via getParameter.
@gssales It was done because this fits the UI5 runtime. Previously, dynamic imports like import("sap/m/MessageBox").Action seemed to work in TypeScript, but did not work with the actual UI5 runtime after transformation because only .default is defined.
Activity
akudev commentedon Oct 6, 2023
Does
in the second line work for you to have at least some simplification?
I think it should, as the keys (alternative proposal) equal the values (your code) in UI5 enums.
(Plus, of course there is the possibility to say
MessageBox["Action"]as suggested in the error message.)Still not perfect, I know. We'll check.
dfenerski commentedon Oct 6, 2023
Thanks for the hint, I've missed that one! It works and not having to type 2 sets of brackets is a big win.
dfenerski commentedon Nov 7, 2023
Hey @akudev, I noticed another thing I wanted to ask about. Tell me if I it does not belong here - It's not directly related to this issue.
During development, I've noticed the

JQuery.Eventis not generic:This forces type casting when retrieving the "parameters" of the event - in this case the
theme. It's not real parameters, its assigned to the object itself and also its not real event, its a jQuery one & with future removal intent of the lib IDK if it's worth a discussion.gssales commentedon Nov 30, 2023
Hello everyone, I just upgraded to this package and I'm having the same issue to import the Action enum from the MessageBox. I know that in older packages of the type declarations the enums were exported with the controls, is there a reason why this was changed for this package?
akudev commentedon Dec 4, 2023
@dfenerski
True, but it's defined by jQuery, not by us. We could probably extend it, but yeah, not really investing into jQuery anymore.
Plus, I wonder how you got to use
JQuery.Eventin this place. YouronThemeChangedis a handler registered via the Core'sattachThemeChanged? But it passes asap.ui.base.Event, not a jQuery one.You could reply: "Ha! Why is it not generic, then?". Well, the reason why this event (and IIRC half a dozen others) are not generic is because how we did it was generically making them generic in the dts generator, but this covered only events fired by classes inheriting from EventProvider. Core isn't one, but does the eventing manually.
We still could make it generic, but

attachThemeChangedis deprecated now and its replacementTheming.attachApplied(...)does have a typed event:Again,
Themingis not an event provider, hence the typing was done manually and it seems the parameters are directly on the event instead of accessible viagetParameter.akudev commentedon Dec 4, 2023
@gssales It was done because this fits the UI5 runtime. Previously, dynamic imports like
import("sap/m/MessageBox").Actionseemed to work in TypeScript, but did not work with the actual UI5 runtime after transformation because only.defaultis defined.