Skip to content

fix: Messenger type errors in ComposableController - #6904

Merged
mikesposito merged 6 commits into
mikesposito/messenger/composable-controllerfrom
jongsun/fix/251021-composable-controller-types
Oct 21, 2025
Merged

fix: Messenger type errors in ComposableController#6904
mikesposito merged 6 commits into
mikesposito/messenger/composable-controllerfrom
jongsun/fix/251021-composable-controller-types

Conversation

@MajorLift

@MajorLiftMajorLift commented Oct 21, 2025

Copy link
Copy Markdown
Contributor

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
MajorLiftforce-pushed the jongsun/fix/251021-composable-controller-types branch from 7248c30 to 4c98b30CompareOctober 21, 2025 15:05
@MajorLiftMajorLift changed the title fix: ComposableController type errorfix: Messenger type errors in ComposableControllerOct 21, 2025
@MajorLift
MajorLift changed the base branch from main to mikesposito/messenger/composable-controllerOctober 21, 2025 15:05
@MajorLift
MajorLiftforce-pushed the jongsun/fix/251021-composable-controller-types branch from 4c98b30 to 0f1ea02CompareOctober 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)
```
@MajorLift
MajorLiftforce-pushed the jongsun/fix/251021-composable-controller-types branch from 0f1ea02 to f781594CompareOctober 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 ownerOctober 21, 2025 17:22
@mikesposito
mikesposito merged commit b3f16e6 into mikesposito/messenger/composable-controllerOct 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 freeto 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.

2 participants

@MajorLift@mikesposito