@@ -171,11 +171,13 @@ export function normalizeToSize<T>(
171171}
172172
173173/**
174- * Transform any non-primitive or Symbol-type value into a string. Acts as a no-op on non-Symbol primitives.
174+ * Transform any non-primitive, BigInt, or Symbol-type value into a string. Acts as a no-op on strings, numbers,
175+ * booleans, null, and undefined.
175176 *
176177 * @param value The value to stringify
177- * @returns For non-primitive and Symbol-type values, a string denoting the value's type, or in the case of a Symbol,
178- * its type and description. For non-Symbol primitives, the original value, unchanged.
178+ * @returns For non-primitive, BigInt, and Symbol-type values, a string denoting the value's type, type and value, or
179+ * type and `description` property, respectively. For non-BigInt, non-Symbol primitives, returns the original value,
180+ * unchanged.
179181 */
180182function serializeValue ( value : any ) : any {
181183 const type = Object . prototype . toString . call ( value ) ;
@@ -242,10 +244,16 @@ function normalizeValue<T>(value: T, key?: any): T | string {
242244 return `[Function: ${ getFunctionName ( value ) } ]` ;
243245 }
244246
247+ // symbols and bigints are considered primitives by TS, but aren't natively JSON-serilaizable
248+
245249 if ( typeof value === 'symbol' ) {
246250 return `[${ String ( value ) } ]` ;
247251 }
248252
253+ if ( typeof value === 'bigint' ) {
254+ return `[BigInt: ${ String ( value ) } ]` ;
255+ }
256+
249257 return value ;
250258}
251259
0 commit comments