11import type { ErrorObject } from 'error-serializer'
22
3- import type { Info , ErrorInstance } from 'modern-errors'
3+ import type { Info } from 'modern-errors'
44
55export type { ErrorObject }
66
@@ -20,8 +20,13 @@ declare const plugin: {
2020 * ([or YAML](https://github.com/ehmicky/error-serializer#custom-serializationparsing),
2121 * etc.). This is
2222 * [automatically called](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#tojson_behavior)
23- * by `JSON.stringify()`. All error properties
24- * [are kept](https://github.com/ehmicky/error-serializer#additional-error-properties).
23+ * by `JSON.stringify()`.
24+ *
25+ * All
26+ * [error properties](https://github.com/ehmicky/error-serializer#additional-error-properties)
27+ * are kept.
28+ * [Plugin options](https://github.com/ehmicky/modern-errors#plugin-options)
29+ * are also preserved.
2530 *
2631 * @example
2732 * ```js
@@ -36,8 +41,10 @@ declare const plugin: {
3641 }
3742 staticMethods : {
3843 /**
39- * Converts an error plain object back to an identical error instance.
40- * The original error class is preserved.
44+ * If `value` is an error plain object, converts it to an error instance.
45+ * Otherwise, recurse over `value` and parse any nested error plain object.
46+ *
47+ * The original error classes are preserved.
4148 *
4249 * @example
4350 * ```js
@@ -48,10 +55,7 @@ declare const plugin: {
4855 * // filePath: '...'
4956 * ```
5057 */
51- parse : (
52- info : Info [ 'staticMethods' ] ,
53- errorObject : ErrorObject ,
54- ) => ErrorInstance
58+ parse : ( info : Info [ 'staticMethods' ] , errorObject : unknown ) => unknown
5559 }
5660}
5761export default plugin
0 commit comments