Skip to content

Commit

Permalink
chore(framework): specify explicit types from mergeDeep return
Browse files Browse the repository at this point in the history
closes #19979
  • Loading branch information
KaelWD committed Jun 10, 2024
1 parent df6440d commit d8e8a0c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
17 changes: 11 additions & 6 deletions packages/vuetify/src/composables/goto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import type { LocaleInstance, RtlInstance } from './locale'

export interface GoToInstance {
rtl: Ref<boolean>
options: GoToOptions
options: InternalGoToOptions
}

export interface GoToOptions {
export interface InternalGoToOptions {
container: ComponentPublicInstance | HTMLElement | string
duration: number
layout: boolean
Expand All @@ -21,6 +21,8 @@ export interface GoToOptions {
patterns: Record<string, (t: number) => number>
}

export type GoToOptions = Partial<InternalGoToOptions>

export const GoToSymbol: InjectionKey<GoToInstance> = Symbol.for('vuetify:goto')

function genDefaults () {
Expand Down Expand Up @@ -69,16 +71,19 @@ function getOffset (target: any, horizontal?: boolean, rtl?: boolean): number {
return totalOffset
}

export function createGoTo (options: Partial<GoToOptions> | undefined, locale: LocaleInstance & RtlInstance) {
export function createGoTo (
options: GoToOptions| undefined,
locale: LocaleInstance & RtlInstance
): GoToInstance {
return {
rtl: locale.isRtl,
options: mergeDeep(genDefaults(), options),
options: mergeDeep(genDefaults(), options) as InternalGoToOptions,
}
}

export async function scrollTo (
_target: ComponentPublicInstance | HTMLElement | number | string,
_options: Partial<GoToOptions>,
_options: GoToOptions,
horizontal?: boolean,
goTo?: GoToInstance,
) {
Expand Down Expand Up @@ -140,7 +145,7 @@ export async function scrollTo (
}))
}

export function useGoTo (_options: Partial<GoToOptions> = {}) {
export function useGoTo (_options: GoToOptions = {}) {
const goToInstance = inject(GoToSymbol)
const { isRtl } = useRtl()

Expand Down
14 changes: 8 additions & 6 deletions packages/vuetify/src/composables/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,20 @@ export interface IconSet {
component: IconComponent
}

export type IconOptions = {
defaultSet?: string
aliases?: Partial<IconAliases>
sets?: Record<string, IconSet>
export type InternalIconOptions = {
defaultSet: string
aliases: Partial<IconAliases>
sets: Record<string, IconSet>
}

export type IconOptions = Partial<InternalIconOptions>

type IconInstance = {
component: IconComponent
icon?: IconValue
}

export const IconSymbol: InjectionKey<Required<IconOptions>> = Symbol.for('vuetify:icons')
export const IconSymbol: InjectionKey<InternalIconOptions> = Symbol.for('vuetify:icons')

export const makeIconProps = propsFactory({
icon: {
Expand Down Expand Up @@ -204,7 +206,7 @@ export function createIcons (options?: IconOptions) {
],
/* eslint-enable max-len */
},
}, options)
}, options) as InternalIconOptions
}

export const useIcon = (props: Ref<IconValue | undefined>) => {
Expand Down

0 comments on commit d8e8a0c

Please # to comment.