Last active
December 17, 2021 06:08
-
-
Save julenwang/87bc5a11347412746a92d7bfa0dec196 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Merge } from 'type-fest'; | |
export type AsyncFunction = (...args: any[]) => Promise<any>; | |
/** | |
* 扩展对象联合类型的每一项 | |
*/ | |
export type ExpandObjectUnion<Union, Item extends Record<string, unknown>> = Union extends unknown | |
? Merge<Union, Item> | |
: never; | |
export type NonNullableAll<T> = { | |
[P in keyof T]: NonNullable<T[P]>; | |
}; | |
export type ArrayItem<T> = T extends (infer P)[] ? P : never; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment