fix(scheduler): add missing type annotation to callActivatedHooks #13292
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Added
Component[]type annotation to the queue parameter in the callActivatedHooks function within src/core/observer/scheduler.ts.Type of Change
The Problem
The callActivatedHooks function lacked a type annotation for its queue parameter, unlike other similar functions in the scheduler (e.g., callUpdatedHooks). This inconsistency reduced type safety and code clarity, potentially allowing incorrect types to be passed during development.
The Solution
Explicitly typed the queue parameter as
Component[]. This aligns with theactivatedChildrenarray type (which is passed to this function) and matches the pattern used in other scheduler hook functions, improving overall code consistency and type safety.Testing
npm run ts-checkto verify no type errors were introduced.npm test -- test/unit/modules/observer/scheduler.spec.tsto ensure scheduler logic remains intact.activatedChildrenis defined asArray<Component>, confirmingComponent[]is the correct type.