mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(types): tidy types for useAsyncData
(#5340)
This commit is contained in:
parent
822928b07e
commit
eafd92c457
@ -5,7 +5,14 @@ import { NuxtApp, useNuxtApp } from '#app'
|
||||
|
||||
export type _Transform<Input = any, Output = any> = (input: Input) => Output
|
||||
|
||||
export type PickFrom<T, K extends Array<string>> = T extends Array<any> ? T : T extends Record<string, any> ? Pick<T, K[number]> : T
|
||||
export type PickFrom<T, K extends Array<string>> = T extends Array<any>
|
||||
? T
|
||||
: T extends Record<string, any>
|
||||
? keyof T extends K[number]
|
||||
? T // Exact same keys as the target, skip Pick
|
||||
: Pick<T, K[number]>
|
||||
: T
|
||||
|
||||
export type KeysOf<T> = Array<keyof T extends string ? keyof T : string>
|
||||
export type KeyOfRes<Transform extends _Transform> = KeysOf<ReturnType<Transform>>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user