Skip to content

Commit

Permalink
fix(types): fix type declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
xxyan0205 committed Aug 1, 2018
1 parent a98a6ee commit 57e3a9e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
12 changes: 8 additions & 4 deletions types/action-sheet.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Vue from 'vue'
import { MandComponent } from './component'

export type ActionSheetItem = {
value: string,
Expand All @@ -18,17 +19,20 @@ export type ActionSheetCreateOptions = {
onSelected?: (item: ActionSheetItem) => void,
}

export interface ActionSheet {
(options?: ActionSheetCreateOptions): void
export interface IActionSheet {
create(options: ActionSheetCreateOptions): Vue
closeAll(): void
destroyAll(): void
}

declare module 'vue/types/vue' {
interface Vue {
$sheet: ActionSheet
$sheet: IActionSheet
}
}

export const ActionSheet: ActionSheet
export class ActionSheet extends MandComponent {
static create(options: ActionSheetCreateOptions): Vue
static closeAll(): void
static destroyAll(): void
}
14 changes: 10 additions & 4 deletions types/dialog.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Vue from 'vue'
import { MandComponent } from './component'

export type DialogOptions = {
title?: string
Expand All @@ -23,8 +24,7 @@ export type DialogSucceedOptions = {

export type DialogFailedOptions = DialogSucceedOptions

export interface Dialog {
(options?: any): void
export interface IDialog {
confirm(options: DialogConfirmOptions): Vue
alert(options: DialogAlertOptions): Vue
succeed(options: DialogSucceedOptions): Vue
Expand All @@ -34,8 +34,14 @@ export interface Dialog {

declare module 'vue/types/vue' {
interface Vue {
$dialog: Dialog
$dialog: IDialog
}
}

export const Dialog: Dialog
export class Dialog extends MandComponent {
static confirm(options: DialogConfirmOptions): Vue
static alert(options: DialogAlertOptions): Vue
static succeed(options: DialogSucceedOptions): Vue
static failed(options: DialogFailedOptions): Vue
static closeAll(): void
}

0 comments on commit 57e3a9e

Please sign in to comment.