fix(nuxt3): correctly type arrays returned from fetch requests (#1089)

This commit is contained in:
Daniel Roe 2021-10-18 09:03:29 +01:00 committed by GitHub
parent ab7aef8a13
commit 93f7d776c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@ 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 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> ? 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>>