From 55ad71ceb29a3bfa9f51b2b717f7b93c1ca3807d Mon Sep 17 00:00:00 2001 From: Iain Shorter Date: Mon, 16 Sep 2024 17:30:49 +0000 Subject: [PATCH] change error to a "deep" type --- src/plainer.ts | 2 ++ src/transformer.ts | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plainer.ts b/src/plainer.ts index 114d76a..a78ba40 100644 --- a/src/plainer.ts +++ b/src/plainer.ts @@ -1,6 +1,7 @@ import { isArray, isEmptyObject, + isError, isMap, isPlainObject, isPrimitive, @@ -95,6 +96,7 @@ const isDeep = (object: any, superJson: SuperJSON): boolean => isArray(object) || isMap(object) || isSet(object) || + isError(object) || isInstanceOfRegisteredClass(object, superJson); function addIdentity(object: any, path: any[], identities: Map) { diff --git a/src/transformer.ts b/src/transformer.ts index b7316e7..fba31be 100644 --- a/src/transformer.ts +++ b/src/transformer.ts @@ -23,7 +23,6 @@ type LeafTypeAnnotation = | PrimitiveTypeAnnotation | 'regexp' | 'Date' - | 'Error' | 'URL'; type TypedArrayAnnotation = ['typed-array', string]; @@ -31,7 +30,7 @@ type ClassTypeAnnotation = ['class', string]; type SymbolTypeAnnotation = ['symbol', string]; type CustomTypeAnnotation = ['custom', string]; -type SimpleTypeAnnotation = LeafTypeAnnotation | 'map' | 'set'; +type SimpleTypeAnnotation = LeafTypeAnnotation | 'map' | 'set' | 'Error'; type CompositeTypeAnnotation = | TypedArrayAnnotation