Skip to content

[composable-controller] Fix BaseControllerV1Instance type and make ChildControllers a required type parameter #4448

@MajorLift

Description

@MajorLift

References

Motivation

The ComposableController API is currently not working as expected in downstream consumers (mobile).

Explanation

  • The BaseControllerV1Instance type needs to be fixed to accommodate controller versions used in mobile that inherit from BaseControllerV1.
    Type 'PhishingController | AccountsController | AccountTrackerController | AddressBookController | ... 22 more ... | SwapsController' does not satisfy the constraint 'ControllerInstance'.
    Type 'AccountTrackerController' is not assignable to type 'ControllerInstance'.
      Type 'AccountTrackerController' is not assignable to type 'BaseControllerV1Instance'.
        Types have separate declarations of a private property 'initialConfig'.ts(2344)
  • The ChildControllers optional generic parameter should either be converted into a required parameter, or annotated in jsdoc to make it clear that a full list of controllers can be supplied by the consumer as a type argument.
  • Fix LegacyComposableControllerStateConstraint to { [name: string]: Record<any, any> }, since index signature of interface types used for V1 state objects is not fixed to string.
  • Test on mobile engine whether runtime checks isBaseController() and isBaseControllerV1() are functioning as intended.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingteam-wallet-frameworkDeprecated: Please use `team-core-platform` instead.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions