Skip to content

fix: ts declaretion export the default class and types #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 20 additions & 24 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;