Skip to content

Commit

Permalink
fix: types
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jul 5, 2021
1 parent daf7dfd commit 297a265
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions packages/core/useFetch/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,11 @@ interface UseFetchReturnBase<T> {
*/
onFetchError: EventHookOn
}
declare type PayloadType = "text" | "json" | "formData"
interface UseFetchReturnTypeConfigured<T> extends UseFetchReturnBase<T> {
get(): UseFetchReturnBase<T>
post(payload?: unknown, type?: PayloadType): UseFetchReturnBase<T>
put(payload?: unknown, type?: PayloadType): UseFetchReturnBase<T>
delete(payload?: unknown, type?: PayloadType): UseFetchReturnBase<T>
post(payload?: unknown, type?: string): UseFetchReturnBase<T>
put(payload?: unknown, type?: string): UseFetchReturnBase<T>
delete(payload?: unknown, type?: string): UseFetchReturnBase<T>
}
export interface UseFetchReturn<T> extends UseFetchReturnTypeConfigured<T> {
json<JSON = any>(): UseFetchReturnTypeConfigured<JSON>
Expand Down
2 changes: 1 addition & 1 deletion packages/core/useTransition/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export function useTransition(

// raw source value
const sourceValue = computed(() => {
const s = unref(source)
const s = unref<number | MaybeRef<number>[]>(source)
return isNumber(s) ? s : s.map(unref) as number[]
})

Expand Down
4 changes: 2 additions & 2 deletions packages/shared/utils/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComputedRef, Ref, WatchOptions, WatchSource } from 'vue-demi'
import { Ref, WatchOptions, WatchSource } from 'vue-demi'

/**
* Any function
Expand All @@ -12,7 +12,7 @@ export type Fn = () => void
* type MaybeRef<T> = T | Ref<T>
* ```
*/
export type MaybeRef<T> = T | Ref<T> | ComputedRef<T>
export type MaybeRef<T> = T | Ref<T>

/**
* Make all the nested attributes of an object or array to MaybeRef<T>
Expand Down

0 comments on commit 297a265

Please sign in to comment.