From 44dd9a276e44570024f9a21cfad4e527c1ebb7c3 Mon Sep 17 00:00:00 2001 From: Riceball LEE Date: Fri, 12 Oct 2018 20:09:23 +0800 Subject: [PATCH] fix: ts declaretion export the default class and types --- types/index.d.ts | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 729148e..b016106 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -5,46 +5,42 @@ import Vue, { VNode } from 'vue'; -declare namespace InfiniteLoading { - type SpinnerType = 'default' | 'bubbles' | 'circles' | 'spiral' | 'waveDots'; - - type DirectionType = 'top' | 'bottom'; - - interface Slots { - spinner: VNode[]; - 'no-result': VNode[]; - 'no-more': VNode[]; - [key: string]: VNode[]; - } - - interface StateChanger { - loaded(): void; - complete(): void; - reset(): void; - } +export type SpinnerType = 'default' | 'bubbles' | 'circles' | 'spiral' | 'waveDots'; +export type DirectionType = 'top' | 'bottom'; + +export interface Slots { + spinner: VNode[]; + 'no-result': VNode[]; + 'no-more': VNode[]; + [key: string]: VNode[]; } -declare class InfiniteLoading extends Vue { +export interface StateChanger { + loaded(): void; + complete(): void; + reset(): void; +} + +export default class InfiniteLoading extends Vue { // The trigger distance distance: number; // The load spinner type - spinner: InfiniteLoading.SpinnerType; + spinner: SpinnerType; // The scroll direction - direction: InfiniteLoading.DirectionType; + direction: DirectionType; // Whether find the element which has `infinite-wrapper` attribute as the scroll wrapper forceUseInfiniteWrapper: boolean; // Infinite event handler - onInfinite: ($state: InfiniteLoading.StateChanger) => void; + onInfinite: ($state: StateChanger) => void; // The method collection used to change infinite state - stateChanger: InfiniteLoading.StateChanger; + stateChanger: StateChanger; // Slots - $slots: InfiniteLoading.Slots; + $slots: Slots; } -export default InfiniteLoading;