TypeScript · Middle · Question 72 of 75
How do you write a type for any JSON value?
type Json = string | number | boolean | null | Json[] | { [key: string]: Json };- ✓Correct answer: A recursive union that references itself in arrays and objects
- 2
object - 3
Record<string, any>
Explanation
Recursive type aliases are allowed when the recursion goes through object or array types.