Skip to content

Commit

Permalink
fix(useFileDialog): explict UseFileDialogReturn type (#1927)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxiangmoe committed Jul 16, 2022
1 parent e84fa0f commit 4619206
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/core/useFileDialog/index.ts
@@ -1,4 +1,4 @@
import { readonly, ref } from 'vue-demi'
import { type Ref, readonly, ref } from 'vue-demi'
import type { ConfigurableDocument } from '../_configurable'
import { defaultDocument } from '../_configurable'

Expand All @@ -23,13 +23,19 @@ const DEFAULT_OPTIONS: UseFileDialogOptions = {
accept: '*',
}

export interface UseFileDialogReturn {
files: Ref<FileList | null>
open: (localOptions?: Partial<UseFileDialogOptions>) => void
reset: () => void
}

/**
* Open file dialog with ease.
*
* @see https://vueuse.org/useFileDialog
* @param options
*/
export function useFileDialog(options: UseFileDialogOptions = {}) {
export function useFileDialog(options: UseFileDialogOptions = {}): UseFileDialogReturn {
const {
document = defaultDocument,
} = options
Expand Down Expand Up @@ -74,5 +80,3 @@ export function useFileDialog(options: UseFileDialogOptions = {}) {
reset,
}
}

export type UseFileDialogReturn = ReturnType<typeof useFileDialog>

0 comments on commit 4619206

Please sign in to comment.