We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8771f5e commit 459f66dCopy full SHA for 459f66d
src/utils/json.ts
@@ -21,8 +21,13 @@ export const prettifiedInspect = (
21
) => {
22
// If it is possible to serialize the object to a simpler structure with toJSON, do it.
23
const simplifiedObject =
24
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
- (object as any).toJSON != null ? (object as any).toJSON() : object;
+ object &&
+ typeof object === 'object' &&
26
+ 'toJSON' in object &&
27
+ typeof object.toJSON === 'function'
28
+ ? object.toJSON()
29
+ : object;
30
+
31
return inspect(simplifiedObject, {
32
compact: false,
33
// TODO: Can potentially support higher depth if one can hide symbols properly.
0 commit comments