Skip to content

Type Alias: SerializableValue

SerializableValue = SerializablePrimitive | SerializableValue[] | {[key: string]: SerializableValue; }

Any value that survives a JSON.stringify/JSON.parse round trip unchanged.

Use it instead of unknown on a boundary that will serialize its input - a message payload, a cache entry, a config blob written to disk - so a Date, a Map, or a class instance is a compile error at the call site rather than a receiver quietly getting a string or {}. isSerializableValue is the runtime half, for input the compiler cannot vouch for.