chore: add explaination about the utility type IfAny<T, Y, N> (#5862) [ci skip]

This commit is contained in:
Dongcai Huang 2022-05-12 09:39:06 +08:00 committed by GitHub
parent d0695dad32
commit 109453f2ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,4 +7,7 @@ export type UnionToIntersection<U> = (
// make keys required but keep undefined values
export type LooseRequired<T> = { [P in string & keyof T]: T[P] }
// If the the type T accepts type "any", output type Y, otherwise output type N.
// https://stackoverflow.com/questions/49927523/disallow-call-with-any/49928360#49928360
export type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N