refactor(tyescript): simplify ref usage in Vue components and composables #1293
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.
This pull request simplifies the use of Vue's
ref
andcomputed
by removing unnecessary explicit type annotations (Ref
andComputedRef
) and streamlining imports. These changes improve code readability and maintainability without altering functionality.Simplification of
ref
andcomputed
usage:Ref
type annotations fromref
declarations across multiple files, simplifying the syntax. For example,const items: Ref<Item[]> = ref([...])
was updated toconst items = ref<Item[]>([...])
inHorizontal.vue
andVertical.vue
. [1] [2]computed
declarations by removingComputedRef
type annotations, e.g.,const classNames: ComputedRef<ClassNames> = computed(...)
was updated toconst classNames = computed<ClassNames>(...)
inBoosterPicture/Base.vue
.ref
andcomputed
usage in various runtime components, such asBoosterImage/Base.vue
,BoosterVimeo/Base.vue
,BoosterYoutube/Base.vue
, and composables likeuseBoosterComponentObserver.ts
anduseBoosterCritical.ts
. [1] [2] [3] [4] [5]Streamlined imports:
type
imports forRef
andComputedRef
where they were no longer necessary after the refactoring. For instance, inBoosterImage/Base.vue
anduseBoosterHead.ts
. [1] [2]These updates reduce boilerplate code and align with Vue's best practices, making the codebase cleaner and easier to maintain.