]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: add explaination about the utility type IfAny<T, Y, N> (#5862) [ci skip]
authorDongcai Huang <StephenChips@users.noreply.github.com>
Thu, 12 May 2022 01:39:06 +0000 (09:39 +0800)
committerGitHub <noreply@github.com>
Thu, 12 May 2022 01:39:06 +0000 (21:39 -0400)
packages/shared/src/typeUtils.ts

index 8caba54c6cae44f61c0643127ebb74f6facdb1d2..8a56abaa2c9ecd37c812b34ea321afb61e9845b8 100644 (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