Skip to content

Commit 109453f

Browse files
authored
chore: add explaination about the utility type IfAny<T, Y, N> (#5862) [ci skip]
1 parent d0695da commit 109453f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/shared/src/typeUtils.ts

+3
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ export type UnionToIntersection<U> = (
77
// make keys required but keep undefined values
88
export type LooseRequired<T> = { [P in string & keyof T]: T[P] }
99

10+
11+
// If the the type T accepts type "any", output type Y, otherwise output type N.
12+
// https://stackoverflow.com/questions/49927523/disallow-call-with-any/49928360#49928360
1013
export type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N

0 commit comments

Comments
 (0)