Skip to content

Conversation

@MajorLift
Copy link
Contributor

@MajorLift MajorLift commented Oct 21, 2025

Explanation

  • Fix incompatibility of ChildControllerStateChangeEvents type with BaseController (when used in the Events type argument of ComposableControllerMessenger) by removing unnecessary nested logic from definition.
  • Update generic parameter names ControllerName and ControllerState to ChildControllerName, ChildControllerState for reduced ambiguity.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Note

Simplifies ChildControllerStateChangeEvents and types the messenger subscribe call to fix ComposableController Messenger type errors; updates changelog.

  • Composable Controller:
    • Types: Simplify ChildControllerStateChangeEvents by removing nested conditional logic and renaming generics to ChildControllerName/ChildControllerState.
    • Messenger: Type the subscribe call for child stateChange events, updating composed state with the received child state (with an inline ts-expect-error to bypass an unnecessary overload constraint).
  • Docs:
    • Update packages/composable-controller/CHANGELOG.md with a Fixed entry describing the type compatibility change.

Written by Cursor Bugbot for commit b3444fb. This will update automatically on new commits. Configure here.

@MajorLift MajorLift force-pushed the jongsun/fix/251021-composable-controller-types branch from 7248c30 to 4c98b30 Compare October 21, 2025 15:05
@MajorLift MajorLift changed the title fix: ComposableController type error fix: Messenger type errors in ComposableController Oct 21, 2025
@MajorLift MajorLift changed the base branch from main to mikesposito/messenger/composable-controller October 21, 2025 15:05
@MajorLift MajorLift force-pushed the jongsun/fix/251021-composable-controller-types branch from 4c98b30 to 0f1ea02 Compare October 21, 2025 15:47
…tiate `BaseController`, due to unnecessarily nested type definition

```ts
Type 'ComposableControllerMessenger<ComposableControllerState>' is not assignable to type '"ComposableController:stateChange" extends (ComposableControllerEvents<ComposableControllerState> | ChildControllerStateChangeEvents<...>)["type"] ? ComposableControllerMessenger<...> : never'.ts(2322)
```
… to only happen for child controller events
@MajorLift MajorLift force-pushed the jongsun/fix/251021-composable-controller-types branch from 0f1ea02 to f781594 Compare October 21, 2025 15:55
@MajorLift MajorLift marked this pull request as ready for review October 21, 2025 17:22
@MajorLift MajorLift requested a review from a team as a code owner October 21, 2025 17:22
@mikesposito mikesposito merged commit b3f16e6 into mikesposito/messenger/composable-controller Oct 21, 2025
160 of 252 checks passed
@mikesposito mikesposito deleted the jongsun/fix/251021-composable-controller-types branch October 21, 2025 17:23
Gudahtt added a commit that referenced this pull request Oct 24, 2025
…-controller' into messenger-preview-v2

* origin/mikesposito/messenger/composable-controller:
  Fix broken delegation in unit test
  Fix changelog
  update changelog and readme
  update changelog
  update tsconfig and README files
  remove .vscode folder
  add test case for child state change subscription failure
  fix: `Messenger` type errors in `ComposableController` (#6904)
  update metadata tests
  rename `anonymous` to `includeInDebugSnapshot`
  revert rename `name` to `controllerName`
  refactor: migrate `ComposableController` to `@metamask/messenger`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants