Helper type to recursively serialize types, handling primitives, arrays, and objects.
This type walks through the type hierarchy and converts each level to its JSON-serializable
equivalent.
Type Parameters
T
The type to serialize
The type checks in order:
If T is a primitive (string, number, boolean, etc.), return as-is
If T is explicitly allowed via ExtendJSONTypes, return as-is
If T is a non-allowed type (Map, Set), return never
If T is an array, recursively serialize array items
If T is an object, recursively serialize object properties
Helper type to recursively serialize types, handling primitives, arrays, and objects. This type walks through the type hierarchy and converts each level to its JSON-serializable equivalent.