Skip to content

Commit

Permalink
fix(types): add missing goTo types (#13812)
Browse files Browse the repository at this point in the history
fixes #9648
  • Loading branch information
jacekkarczmarczyk committed Jun 22, 2021
1 parent 43b0406 commit 9f6d0c0
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
8 changes: 7 additions & 1 deletion packages/api-generator/src/maps/$vuetify.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ module.exports = {
functions: [
{
name: 'goTo',
signature: '() => void',
signature: `(target: number | string | HTMLElement | Vue, options?: {
container?: string | HTMLElement | Vue
duration?: number
offset?: number
easing?: VuetifyGoToEasing
appOffset?: boolean
}): Promise<number>`,
},
],
},
Expand Down
8 changes: 7 additions & 1 deletion packages/api-generator/src/maps/vuetify.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ module.exports = {
functions: [
{
name: 'goTo',
signature: '(target: string | number | HTMLElement | VueComponent, options?: object): void',
signature: `(target: number | string | HTMLElement | Vue, options?: {
container?: string | HTMLElement | Vue
duration?: number
offset?: number
easing?: VuetifyGoToEasing
appOffset?: boolean
}): Promise<number>`,
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/components/api/ApiTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

<template v-else-if="header === 'type' || header === 'signature'">
<div
class="text-mono"
class="text-mono text-pre"
v-html="getType(item[header])"
/>
</template>
Expand Down
2 changes: 1 addition & 1 deletion packages/vuetify/src/services/goto/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { VuetifyServiceContract } from 'vuetify/types/services'

export default function goTo (
_target: VuetifyGoToTarget,
_settings: Partial<GoToOptions> = {}
_settings: GoToOptions = {}
): Promise<number> {
const settings: GoToOptions = {
container: (document.scrollingElement as HTMLElement | null) || document.body || document.documentElement,
Expand Down
4 changes: 2 additions & 2 deletions packages/vuetify/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from './services/presets'

// Service Options
import { GoToOptions } from './services/goto'
import { GoToOptions, VuetifyGoToTarget } from './services/goto'

export default class Vuetify {
constructor (preset?: Partial<UserVuetifyPreset>)
Expand Down Expand Up @@ -48,7 +48,7 @@ export interface VuetifyUseOptions {

export interface Framework {
readonly breakpoint: Breakpoint
readonly goTo: <T extends string | number | HTMLElement | Vue>(target: T, options?: GoToOptions) => Promise<T>
readonly goTo: (target: VuetifyGoToTarget, options?: GoToOptions) => Promise<number>
application: Application
theme: Theme
icons: Icons
Expand Down
4 changes: 3 additions & 1 deletion packages/vuetify/types/services/goto.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Types
import Vue from 'vue'

type VuetifyGoToTarget = number | string | HTMLElement | Vue
export type VuetifyGoToTarget = number | string | HTMLElement | Vue

export type VuetifyGoToEasing =
((t: number) => number) |
Expand All @@ -26,3 +26,5 @@ export interface GoToOptions {
easing?: VuetifyGoToEasing
appOffset?: boolean
}

export default function goTo(target: VuetifyGoToTarget, options?: GoToOptions): Promise<number>

0 comments on commit 9f6d0c0

Please sign in to comment.