From f6a6596815ec5beeb57c404de1ad4a30a645cd94 Mon Sep 17 00:00:00 2001 From: Christian Stornowski Date: Tue, 17 Sep 2019 12:30:22 +0200 Subject: [PATCH 1/2] fix: improved type definitions (#160) * Added better types for typescript * Added missing cancel function --- vue-scrollto.d.ts | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/vue-scrollto.d.ts b/vue-scrollto.d.ts index 330f6da3..67d6a12b 100644 --- a/vue-scrollto.d.ts +++ b/vue-scrollto.d.ts @@ -1,36 +1,39 @@ -import Vue, { DirectiveOptions, PluginObject } from "vue" +import {DirectiveOptions, PluginObject} from "vue" type ElementDescriptor = Element | string export interface ScrollOptions { - container?: ElementDescriptor - duration?: number - easing?: string - offset?: number - force?: boolean - cancelable?: boolean - onStart?: false | ((element: Element) => any) - onDone?: false | ((element: Element) => any) - onCancel?: false | ((event: Event, element: Element) => any) - x?: boolean - y?: boolean + el?: ElementDescriptor; + element?: ElementDescriptor; + container?: ElementDescriptor; + duration?: number; + easing?: string | [number, number, number, number]; + offset?: number | ((element: ElementDescriptor, container: ElementDescriptor) => number); + force?: boolean; + cancelable?: boolean; + onStart?: ((element: Element) => any) | false; + onDone?: ((element: Element) => any) | false; + onCancel?: ((event: Event, element: Element) => any) | false; + x?: boolean; + y?: boolean; } -type ScrollToFunction = ( - element: ElementDescriptor, - duration?: number, - options?: ScrollOptions, -) => () => void +type ScrollToFunction = { + (options: ScrollOptions): () => void; + (element: ElementDescriptor, options?: ScrollOptions): () => void; + (element: ElementDescriptor, duration: number, options?: ScrollOptions): () => void; +} declare const _default: PluginObject & - DirectiveOptions & { + DirectiveOptions & { scrollTo: ScrollToFunction - } + setDefaults: ScrollToFunction; +}; export default _default declare module "vue/types/vue" { - interface Vue { - $scrollTo: ScrollToFunction - } + interface Vue { + $scrollTo: ScrollToFunction + } } From d71288df1ca5ddf5b9b26aa4d76b836221d92fdc Mon Sep 17 00:00:00 2001 From: rigor789 Date: Tue, 17 Sep 2019 10:30:51 +0000 Subject: [PATCH 2/2] chore(changelog): 2.17.1 [ci skip] --- docs/changelog/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/changelog/README.md b/docs/changelog/README.md index 37592ac9..4e4d7ac4 100644 --- a/docs/changelog/README.md +++ b/docs/changelog/README.md @@ -1,3 +1,10 @@ +## [2.17.1](https://github.com/rigor789/vue-scrollto/compare/v2.17.0...v2.17.1) (2019-09-17) + + +### Bug Fixes + +* improved type definitions ([#160](https://github.com/rigor789/vue-scrollto/issues/160)) ([f6a6596](https://github.com/rigor789/vue-scrollto/commit/f6a6596)) + # [2.17.0](https://github.com/rigor789/vue-scrollto/compare/v2.16.3...v2.17.0) (2019-09-16)