I\'d like to map an object recursively so that the primitive values in the object are converted to some other type.
For example, I\'d like an object like this:
You were really close. The problem here is that string is assignable to {}.
Demonstration of this fact here.
If you check for the string, number, etc. first before {}, then you can get what you want:
type ConvertToTest = {
[P in keyof T]: T[P] extends any[]
? ConvertToTest
: T[P] extends string
? Test
: T[P] extends number
? Test
: T[P] extends boolean
? Test
: ConvertToTest
}