From cfa587388db5fa0adfe85e1503d1316859cc32f7 Mon Sep 17 00:00:00 2001 From: Christian Stornowski Date: Wed, 11 Sep 2019 16:10:48 +0200 Subject: [PATCH] Adjusted vue-scrollto definition for vue-scrollto version 2.15 (#37666) * Adjusted vue-scrollto definition for vue-scrollto version 2.15 * Removed an empty line to start broken build * Added an empty line to start broken build * Fixed linter issues * Aligned VueScrollTo definition with other vue plugins definitions --- types/vue-scrollto/index.d.ts | 13 +++++++------ types/vue-scrollto/vue-scrollto-tests.ts | 4 ++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/types/vue-scrollto/index.d.ts b/types/vue-scrollto/index.d.ts index e020d29533..44be2c7fa7 100644 --- a/types/vue-scrollto/index.d.ts +++ b/types/vue-scrollto/index.d.ts @@ -1,10 +1,11 @@ -// Type definitions for vue-scrollto 2.14 +// Type definitions for vue-scrollto 2.15 // Project: https://github.com/rigor789/vue-scrollto#readme // Definitions by: Kovács Vince +// ChristianStornowski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -import { PluginFunction } from "vue"; +import { PluginFunction, PluginObject } from "vue"; declare namespace VueScrollTo { interface Options { @@ -16,7 +17,7 @@ declare namespace VueScrollTo { // The duration (in milliseconds) of the scrolling animation. Default: 500 duration?: number; // The easing to be used when animating. Default: ease - easing?: string; + easing?: string | [number, number, number, number]; // The offset that should be applied when scrolling. Default: 0 offset?: number; // Indicates if scrolling should be performed, even if the scroll target is already in view. Default: true @@ -45,10 +46,9 @@ declare namespace VueScrollTo { } } -declare class VueScrollTo { - static install: PluginFunction; - +interface VueScrollToPlugin extends PluginObject { scrollTo: VueScrollTo.VueStatic; + setDefaults: VueScrollTo.VueStatic; } declare module 'vue/types/vue' { @@ -57,4 +57,5 @@ declare module 'vue/types/vue' { } } +declare const VueScrollTo: VueScrollToPlugin; export = VueScrollTo; diff --git a/types/vue-scrollto/vue-scrollto-tests.ts b/types/vue-scrollto/vue-scrollto-tests.ts index 3ca628823b..d1803d05f2 100644 --- a/types/vue-scrollto/vue-scrollto-tests.ts +++ b/types/vue-scrollto/vue-scrollto-tests.ts @@ -2,10 +2,14 @@ import Vue from "vue"; import * as VueScrollTo from "vue-scrollto"; Vue.use(VueScrollTo); +Vue.use(VueScrollTo, {offset: -100}); + +VueScrollTo.setDefaults({offset: -100}); class Test extends Vue { mounted() { this.$scrollTo(this.$el, {offset: -100}); this.$scrollTo("#id"); + VueScrollTo.scrollTo("#id", {offset: -100}); } }