[ui_actions] Remove declare module
pattern for trigger/action mappings
#82790
Labels
Feature:UIActions
UI actions. These are client side only, not related to the server side actions..
impact:low
Addressing this issue will have a low level of impact on the quality/strength of our product.
loe:small
Small Level of Effort
technical debt
Improvement of the software architecture and operational architecture
Currently the
ui_actions
plugin exposesTriggerContextMapping
andActionContextMapping
as interfaces that can be augmented by other plugins which are registering custom triggers/actions like so (example fromdata
):This pattern was originally borrowed from core's
RouteHandlerContext
, however this is something we are looking to move away from.While the simplicity of importing a single interface for everything in a registry is convenient, it can create implicit dependencies between plugins. (If your plugin depends on a trigger registered by another plugin, you should import any necessary types directly from that plugin instead of accessing it indirectly via the
ui_actions
typings).One strategy for solving this could be removing the "mapping" interfaces and instead modifying generic type params where applicable, so that folks can specify the expected return types which you cast to internally, e.g.
Alternatively you can put the responsibility on consumers to directly do casting:
The text was updated successfully, but these errors were encountered: