Type guard: detect whether a type is JSON serializable.
Type to test
Recursively inspects the structure of T to ensure all components are compatible with JSON serialization rules.
T
Loose check: functions are considered non-serializable, but JSON.stringify will allow them (they get stripped).
Will not detect cyclic references in objects.
type A = IsJSONSerializable< { a: string; b: number[] } >; // truetype B = IsJSONSerializable< symbol >; // false Copy
type A = IsJSONSerializable< { a: string; b: number[] } >; // truetype B = IsJSONSerializable< symbol >; // false
Type guard: detect whether a type is JSON serializable.