@devp0nt/error0 1.0.0-next.41 → 1.0.0-next.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +84 -74
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +120 -103
- package/dist/esm/index.d.ts +120 -103
- package/dist/esm/index.js +83 -73
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.test.ts +125 -36
- package/src/index.ts +331 -240
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,44 +1,60 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
1
|
+
type IsUnknown<T> = unknown extends T ? ([T] extends [unknown] ? true : false) : false;
|
|
2
|
+
type NormalizeUnknownToUndefined<T> = IsUnknown<T> extends true ? undefined : T;
|
|
3
|
+
type IsOnlyUndefined<T> = [Exclude<T, undefined>] extends [never] ? true : false;
|
|
4
|
+
type InferFirstArg<TFn> = TFn extends (...args: infer TArgs) => unknown ? TArgs extends [infer TFirst, ...unknown[]] ? TFirst : undefined : undefined;
|
|
5
|
+
type InferPluginPropInput<TProp extends ErrorPluginPropOptions<any, any, any, any>> = TProp extends {
|
|
6
|
+
init: infer TInit;
|
|
7
|
+
} ? NormalizeUnknownToUndefined<InferFirstArg<TInit>> : undefined;
|
|
8
|
+
type ErrorPluginPropInit<TInputValue, TOutputValue> = ((input: TInputValue) => TOutputValue) | (() => TOutputValue);
|
|
9
|
+
type ErrorPluginPropSerialize<TOutputValue, TError extends Error0> = ((options: {
|
|
10
|
+
value: TOutputValue;
|
|
11
|
+
error: TError;
|
|
12
|
+
isPublic: boolean;
|
|
13
|
+
}) => unknown) | false;
|
|
14
|
+
type ErrorPluginPropDeserialize<TOutputValue> = ((options: {
|
|
15
|
+
value: unknown;
|
|
16
|
+
serialized: Record<string, unknown>;
|
|
17
|
+
}) => TOutputValue | undefined) | false;
|
|
18
|
+
type ErrorPluginPropOptionsBase<TOutputValue, TError extends Error0, TResolveValue extends TOutputValue | undefined> = {
|
|
3
19
|
resolve: (options: {
|
|
4
20
|
value: TOutputValue | undefined;
|
|
5
21
|
flow: Array<TOutputValue | undefined>;
|
|
6
22
|
error: TError;
|
|
7
|
-
}) =>
|
|
8
|
-
serialize:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
type
|
|
19
|
-
type
|
|
20
|
-
type
|
|
23
|
+
}) => TResolveValue;
|
|
24
|
+
serialize: ErrorPluginPropSerialize<TResolveValue, TError>;
|
|
25
|
+
deserialize: ErrorPluginPropDeserialize<TOutputValue>;
|
|
26
|
+
};
|
|
27
|
+
type ErrorPluginPropOptionsWithInit<TInputValue, TOutputValue, TError extends Error0, TResolveValue extends TOutputValue | undefined> = ErrorPluginPropOptionsBase<TOutputValue, TError, TResolveValue> & {
|
|
28
|
+
init: ErrorPluginPropInit<TInputValue, TOutputValue>;
|
|
29
|
+
};
|
|
30
|
+
type ErrorPluginPropOptionsWithoutInit<TOutputValue, TError extends Error0, TResolveValue extends TOutputValue | undefined> = ErrorPluginPropOptionsBase<TOutputValue, TError, TResolveValue> & {
|
|
31
|
+
init?: undefined;
|
|
32
|
+
};
|
|
33
|
+
type ErrorPluginPropOptions<TInputValue = undefined, TOutputValue = unknown, TError extends Error0 = Error0, TResolveValue extends TOutputValue | undefined = TOutputValue | undefined> = ErrorPluginPropOptionsWithInit<TInputValue, TOutputValue, TError, TResolveValue> | ErrorPluginPropOptionsWithoutInit<TOutputValue, TError, TResolveValue>;
|
|
34
|
+
type ErrorPluginMethodFn<TOutputValue, TArgs extends unknown[] = unknown[], TError extends Error0 = Error0> = (error: TError, ...args: TArgs) => TOutputValue;
|
|
35
|
+
type ErrorPluginAdaptResult<TOutputProps extends Record<string, unknown>> = Partial<TOutputProps> | undefined;
|
|
36
|
+
type ErrorPluginAdaptFn<TError extends Error0 = Error0, TOutputProps extends Record<string, unknown> = Record<never, never>> = ((error: TError) => void) | ((error: TError) => ErrorPluginAdaptResult<TOutputProps>);
|
|
21
37
|
type ErrorMethodRecord = {
|
|
22
38
|
args: unknown[];
|
|
23
39
|
output: unknown;
|
|
24
40
|
};
|
|
25
|
-
type
|
|
26
|
-
[key: string]:
|
|
41
|
+
type ErrorPluginProps = {
|
|
42
|
+
[key: string]: ErrorPluginPropOptions<any, any>;
|
|
27
43
|
};
|
|
28
|
-
type
|
|
29
|
-
[key: string]:
|
|
44
|
+
type ErrorPluginMethods = {
|
|
45
|
+
[key: string]: ErrorPluginMethodFn<any, any[]>;
|
|
30
46
|
};
|
|
31
|
-
type
|
|
47
|
+
type ErrorPlugin<TProps extends ErrorPluginProps = Record<never, never>, TMethods extends ErrorPluginMethods = Record<never, never>> = {
|
|
32
48
|
props?: TProps;
|
|
33
49
|
methods?: TMethods;
|
|
34
|
-
|
|
50
|
+
adapt?: Array<ErrorPluginAdaptFn<Error0, PluginOutputProps<TProps>>>;
|
|
35
51
|
};
|
|
36
|
-
type
|
|
37
|
-
type
|
|
38
|
-
type
|
|
39
|
-
[TKey in keyof TProps]: TProps[TKey] extends
|
|
52
|
+
type AddPropToPluginProps<TProps extends ErrorPluginProps, TKey extends string, TInputValue, TOutputValue, TResolveValue extends TOutputValue | undefined = TOutputValue | undefined> = TProps & Record<TKey, ErrorPluginPropOptions<TInputValue, TOutputValue, Error0, TResolveValue>>;
|
|
53
|
+
type AddMethodToPluginMethods<TMethods extends ErrorPluginMethods, TKey extends string, TArgs extends unknown[], TOutputValue> = TMethods & Record<TKey, ErrorPluginMethodFn<TOutputValue, TArgs>>;
|
|
54
|
+
type PluginOutputProps<TProps extends ErrorPluginProps> = {
|
|
55
|
+
[TKey in keyof TProps]: TProps[TKey] extends ErrorPluginPropOptions<any, any, any, infer TResolveValue> ? TResolveValue : never;
|
|
40
56
|
};
|
|
41
|
-
type
|
|
57
|
+
type ErrorPluginsMap = {
|
|
42
58
|
props: Record<string, {
|
|
43
59
|
init: unknown;
|
|
44
60
|
resolve: unknown;
|
|
@@ -49,103 +65,104 @@ type IsEmptyObject<T> = keyof T extends never ? true : false;
|
|
|
49
65
|
type ErrorInputBase = {
|
|
50
66
|
cause?: unknown;
|
|
51
67
|
};
|
|
52
|
-
type
|
|
53
|
-
[TKey in keyof
|
|
54
|
-
}
|
|
55
|
-
type
|
|
56
|
-
|
|
68
|
+
type ErrorInputPluginProps<TPluginsMap extends ErrorPluginsMap> = {
|
|
69
|
+
[TKey in keyof TPluginsMap['props'] as IsOnlyUndefined<TPluginsMap['props'][TKey]['init']> extends true ? never : TKey]?: TPluginsMap['props'][TKey]['init'];
|
|
70
|
+
};
|
|
71
|
+
type ErrorInput<TPluginsMap extends ErrorPluginsMap> = IsEmptyObject<TPluginsMap['props']> extends true ? ErrorInputBase : ErrorInputBase & ErrorInputPluginProps<TPluginsMap>;
|
|
72
|
+
type ErrorResolvedProps<TPluginsMap extends ErrorPluginsMap> = {
|
|
73
|
+
[TKey in keyof TPluginsMap['props']]: TPluginsMap['props'][TKey]['resolve'];
|
|
57
74
|
};
|
|
58
|
-
type
|
|
59
|
-
[TKey in keyof
|
|
75
|
+
type ErrorMethods<TPluginsMap extends ErrorPluginsMap> = {
|
|
76
|
+
[TKey in keyof TPluginsMap['methods']]: TPluginsMap['methods'][TKey] extends {
|
|
60
77
|
args: infer TArgs extends unknown[];
|
|
61
78
|
output: infer TOutput;
|
|
62
79
|
} ? (...args: TArgs) => TOutput : never;
|
|
63
80
|
};
|
|
64
|
-
type
|
|
65
|
-
type ErrorStaticMethods<
|
|
66
|
-
[TKey in keyof
|
|
81
|
+
type ErrorResolved<TPluginsMap extends ErrorPluginsMap> = ErrorResolvedProps<TPluginsMap> & ErrorMethods<TPluginsMap>;
|
|
82
|
+
type ErrorStaticMethods<TPluginsMap extends ErrorPluginsMap> = {
|
|
83
|
+
[TKey in keyof TPluginsMap['methods']]: TPluginsMap['methods'][TKey] extends {
|
|
67
84
|
args: infer TArgs extends unknown[];
|
|
68
85
|
output: infer TOutput;
|
|
69
86
|
} ? (error: unknown, ...args: TArgs) => TOutput : never;
|
|
70
87
|
};
|
|
71
|
-
type
|
|
88
|
+
type EmptyPluginsMap = {
|
|
72
89
|
props: Record<never, {
|
|
73
90
|
init: never;
|
|
74
91
|
resolve: never;
|
|
75
92
|
}>;
|
|
76
93
|
methods: Record<never, ErrorMethodRecord>;
|
|
77
94
|
};
|
|
78
|
-
type
|
|
79
|
-
[TKey in keyof NonNullable<
|
|
80
|
-
init:
|
|
81
|
-
resolve:
|
|
95
|
+
type PluginPropsMapOf<TPlugin extends ErrorPlugin> = {
|
|
96
|
+
[TKey in keyof NonNullable<TPlugin['props']>]: NonNullable<TPlugin['props']>[TKey] extends ErrorPluginPropOptions<any, any, any, infer TResolveValue> ? {
|
|
97
|
+
init: InferPluginPropInput<NonNullable<TPlugin['props']>[TKey]>;
|
|
98
|
+
resolve: TResolveValue;
|
|
82
99
|
} : never;
|
|
83
100
|
};
|
|
84
|
-
type
|
|
85
|
-
[TKey in keyof NonNullable<
|
|
101
|
+
type PluginMethodsMapOf<TPlugin extends ErrorPlugin> = {
|
|
102
|
+
[TKey in keyof NonNullable<TPlugin['methods']>]: NonNullable<TPlugin['methods']>[TKey] extends (error: Error0, ...args: infer TArgs extends unknown[]) => infer TOutput ? {
|
|
86
103
|
args: TArgs;
|
|
87
104
|
output: TOutput;
|
|
88
105
|
} : never;
|
|
89
106
|
};
|
|
90
|
-
type
|
|
91
|
-
props:
|
|
92
|
-
methods:
|
|
93
|
-
};
|
|
94
|
-
type
|
|
95
|
-
props: TMap['props'] &
|
|
96
|
-
methods: TMap['methods'] &
|
|
97
|
-
};
|
|
98
|
-
type
|
|
99
|
-
type
|
|
100
|
-
type
|
|
101
|
-
|
|
102
|
-
} ?
|
|
103
|
-
type
|
|
104
|
-
type ErrorInstanceOfMap<TMap extends
|
|
105
|
-
type BuilderError0<TProps extends
|
|
106
|
-
type
|
|
107
|
-
declare class
|
|
108
|
-
private readonly
|
|
107
|
+
type ErrorPluginsMapOfPlugin<TPlugin extends ErrorPlugin> = {
|
|
108
|
+
props: PluginPropsMapOf<TPlugin>;
|
|
109
|
+
methods: PluginMethodsMapOf<TPlugin>;
|
|
110
|
+
};
|
|
111
|
+
type ExtendErrorPluginsMap<TMap extends ErrorPluginsMap, TPlugin extends ErrorPlugin> = {
|
|
112
|
+
props: TMap['props'] & ErrorPluginsMapOfPlugin<TPlugin>['props'];
|
|
113
|
+
methods: TMap['methods'] & ErrorPluginsMapOfPlugin<TPlugin>['methods'];
|
|
114
|
+
};
|
|
115
|
+
type ExtendErrorPluginsMapWithProp<TMap extends ErrorPluginsMap, TKey extends string, TInputValue, TOutputValue, TResolveValue extends TOutputValue | undefined = TOutputValue | undefined> = ExtendErrorPluginsMap<TMap, ErrorPlugin<Record<TKey, ErrorPluginPropOptions<TInputValue, TOutputValue, Error0, TResolveValue>>>>;
|
|
116
|
+
type ExtendErrorPluginsMapWithMethod<TMap extends ErrorPluginsMap, TKey extends string, TArgs extends unknown[], TOutputValue> = ExtendErrorPluginsMap<TMap, ErrorPlugin<Record<never, never>, Record<TKey, ErrorPluginMethodFn<TOutputValue, TArgs>>>>;
|
|
117
|
+
type PluginsMapOf<TClass> = TClass extends {
|
|
118
|
+
__pluginsMap?: infer TPluginsMap;
|
|
119
|
+
} ? TPluginsMap extends ErrorPluginsMap ? TPluginsMap : EmptyPluginsMap : EmptyPluginsMap;
|
|
120
|
+
type PluginsMapFromParts<TProps extends ErrorPluginProps, TMethods extends ErrorPluginMethods> = ErrorPluginsMapOfPlugin<ErrorPlugin<TProps, TMethods>>;
|
|
121
|
+
type ErrorInstanceOfMap<TMap extends ErrorPluginsMap> = Error0 & ErrorResolved<TMap>;
|
|
122
|
+
type BuilderError0<TProps extends ErrorPluginProps, TMethods extends ErrorPluginMethods> = Error0 & ErrorResolved<PluginsMapFromParts<TProps, TMethods>>;
|
|
123
|
+
type PluginOfBuilder<TBuilder> = TBuilder extends PluginError0<infer TProps, infer TMethods> ? ErrorPlugin<TProps, TMethods> : never;
|
|
124
|
+
declare class PluginError0<TProps extends ErrorPluginProps = Record<never, never>, TMethods extends ErrorPluginMethods = Record<never, never>> {
|
|
125
|
+
private readonly _plugin;
|
|
109
126
|
readonly Infer: {
|
|
110
127
|
props: TProps;
|
|
111
128
|
methods: TMethods;
|
|
112
129
|
};
|
|
113
|
-
constructor(
|
|
114
|
-
prop<TKey extends string, TInputValue, TOutputValue>(key: TKey, value:
|
|
115
|
-
method<TKey extends string, TArgs extends unknown[], TOutputValue>(key: TKey, value:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
130
|
+
constructor(plugin?: ErrorPlugin<ErrorPluginProps, ErrorPluginMethods>);
|
|
131
|
+
prop<TKey extends string, TInputValue = undefined, TOutputValue = unknown, TResolveValue extends TOutputValue | undefined = TOutputValue | undefined>(key: TKey, value: ErrorPluginPropOptions<TInputValue, TOutputValue, BuilderError0<TProps, TMethods>, TResolveValue>): PluginError0<AddPropToPluginProps<TProps, TKey, TInputValue, TOutputValue, TResolveValue>, TMethods>;
|
|
132
|
+
method<TKey extends string, TArgs extends unknown[], TOutputValue>(key: TKey, value: ErrorPluginMethodFn<TOutputValue, TArgs, BuilderError0<TProps, TMethods>>): PluginError0<TProps, AddMethodToPluginMethods<TMethods, TKey, TArgs, TOutputValue>>;
|
|
133
|
+
adapt(value: ErrorPluginAdaptFn<BuilderError0<TProps, TMethods>, PluginOutputProps<TProps>>): PluginError0<TProps, TMethods>;
|
|
134
|
+
use<TKey extends string, TInputValue = undefined, TOutputValue = unknown, TResolveValue extends TOutputValue | undefined = TOutputValue | undefined>(kind: 'prop', key: TKey, value: ErrorPluginPropOptions<TInputValue, TOutputValue, BuilderError0<TProps, TMethods>, TResolveValue>): PluginError0<AddPropToPluginProps<TProps, TKey, TInputValue, TOutputValue, TResolveValue>, TMethods>;
|
|
135
|
+
use<TKey extends string, TArgs extends unknown[], TOutputValue>(kind: 'method', key: TKey, value: ErrorPluginMethodFn<TOutputValue, TArgs, BuilderError0<TProps, TMethods>>): PluginError0<TProps, AddMethodToPluginMethods<TMethods, TKey, TArgs, TOutputValue>>;
|
|
136
|
+
use(kind: 'adapt', value: ErrorPluginAdaptFn<BuilderError0<TProps, TMethods>, PluginOutputProps<TProps>>): PluginError0<TProps, TMethods>;
|
|
120
137
|
}
|
|
121
|
-
type ClassError0<
|
|
122
|
-
new (message: string, input?: ErrorInput<
|
|
138
|
+
type ClassError0<TPluginsMap extends ErrorPluginsMap = EmptyPluginsMap> = {
|
|
139
|
+
new (message: string, input?: ErrorInput<TPluginsMap>): Error0 & ErrorResolved<TPluginsMap>;
|
|
123
140
|
new (input: {
|
|
124
141
|
message: string;
|
|
125
|
-
} & ErrorInput<
|
|
126
|
-
readonly
|
|
127
|
-
from: (error: unknown) => Error0 &
|
|
142
|
+
} & ErrorInput<TPluginsMap>): Error0 & ErrorResolved<TPluginsMap>;
|
|
143
|
+
readonly __pluginsMap?: TPluginsMap;
|
|
144
|
+
from: (error: unknown) => Error0 & ErrorResolved<TPluginsMap>;
|
|
128
145
|
serialize: (error: unknown, isPublic?: boolean) => Record<string, unknown>;
|
|
129
|
-
prop: <TKey extends string, TInputValue, TOutputValue>(key: TKey, value:
|
|
130
|
-
method: <TKey extends string, TArgs extends unknown[], TOutputValue>(key: TKey, value:
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
<TBuilder extends
|
|
134
|
-
<TKey extends string, TInputValue, TOutputValue>(kind: 'prop', key: TKey, value:
|
|
135
|
-
<TKey extends string, TArgs extends unknown[], TOutputValue>(kind: 'method', key: TKey, value:
|
|
136
|
-
(kind: '
|
|
146
|
+
prop: <TKey extends string, TInputValue = undefined, TOutputValue = unknown, TResolveValue extends TOutputValue | undefined = TOutputValue | undefined>(key: TKey, value: ErrorPluginPropOptions<TInputValue, TOutputValue, ErrorInstanceOfMap<TPluginsMap>, TResolveValue>) => ClassError0<ExtendErrorPluginsMapWithProp<TPluginsMap, TKey, TInputValue, TOutputValue, TResolveValue>>;
|
|
147
|
+
method: <TKey extends string, TArgs extends unknown[], TOutputValue>(key: TKey, value: ErrorPluginMethodFn<TOutputValue, TArgs, ErrorInstanceOfMap<TPluginsMap>>) => ClassError0<ExtendErrorPluginsMapWithMethod<TPluginsMap, TKey, TArgs, TOutputValue>>;
|
|
148
|
+
adapt: (value: ErrorPluginAdaptFn<ErrorInstanceOfMap<TPluginsMap>, ErrorResolvedProps<TPluginsMap>>) => ClassError0<TPluginsMap>;
|
|
149
|
+
use: {
|
|
150
|
+
<TBuilder extends PluginError0>(plugin: TBuilder): ClassError0<ExtendErrorPluginsMap<TPluginsMap, PluginOfBuilder<TBuilder>>>;
|
|
151
|
+
<TKey extends string, TInputValue = undefined, TOutputValue = unknown, TResolveValue extends TOutputValue | undefined = TOutputValue | undefined>(kind: 'prop', key: TKey, value: ErrorPluginPropOptions<TInputValue, TOutputValue, ErrorInstanceOfMap<TPluginsMap>, TResolveValue>): ClassError0<ExtendErrorPluginsMapWithProp<TPluginsMap, TKey, TInputValue, TOutputValue, TResolveValue>>;
|
|
152
|
+
<TKey extends string, TArgs extends unknown[], TOutputValue>(kind: 'method', key: TKey, value: ErrorPluginMethodFn<TOutputValue, TArgs, ErrorInstanceOfMap<TPluginsMap>>): ClassError0<ExtendErrorPluginsMapWithMethod<TPluginsMap, TKey, TArgs, TOutputValue>>;
|
|
153
|
+
(kind: 'adapt', value: ErrorPluginAdaptFn<ErrorInstanceOfMap<TPluginsMap>, ErrorResolvedProps<TPluginsMap>>): ClassError0<TPluginsMap>;
|
|
137
154
|
};
|
|
138
|
-
|
|
139
|
-
} & ErrorStaticMethods<
|
|
155
|
+
plugin: () => PluginError0;
|
|
156
|
+
} & ErrorStaticMethods<TPluginsMap>;
|
|
140
157
|
declare class Error0 extends Error {
|
|
141
|
-
static readonly
|
|
142
|
-
protected static
|
|
143
|
-
private static readonly
|
|
144
|
-
private static
|
|
145
|
-
constructor(message: string, input?: ErrorInput<
|
|
158
|
+
static readonly __pluginsMap?: EmptyPluginsMap;
|
|
159
|
+
protected static _plugins: ErrorPlugin[];
|
|
160
|
+
private static readonly _emptyPlugin;
|
|
161
|
+
private static _getResolvedPlugin;
|
|
162
|
+
constructor(message: string, input?: ErrorInput<EmptyPluginsMap>);
|
|
146
163
|
constructor(input: {
|
|
147
164
|
message: string;
|
|
148
|
-
} & ErrorInput<
|
|
165
|
+
} & ErrorInput<EmptyPluginsMap>);
|
|
149
166
|
private static readonly isSelfProperty;
|
|
150
167
|
static own(error: object, key: string): unknown;
|
|
151
168
|
own(key: string): unknown;
|
|
@@ -158,22 +175,22 @@ declare class Error0 extends Error {
|
|
|
158
175
|
static is<T extends typeof Error0>(this: T, error: unknown): error is InstanceType<T>;
|
|
159
176
|
static isSerialized(error: unknown): error is Record<string, unknown>;
|
|
160
177
|
static from(error: unknown): Error0;
|
|
161
|
-
private static
|
|
178
|
+
private static _applyAdapt;
|
|
162
179
|
private static _fromSerialized;
|
|
163
180
|
private static _fromNonError0;
|
|
164
181
|
private static _extractMessage;
|
|
165
|
-
private static
|
|
166
|
-
private static
|
|
167
|
-
static prop<TThis extends typeof Error0, TKey extends string, TInputValue, TOutputValue>(this: TThis, key: TKey, value:
|
|
168
|
-
static method<TThis extends typeof Error0, TKey extends string, TArgs extends unknown[], TOutputValue>(this: TThis, key: TKey, value:
|
|
169
|
-
static
|
|
170
|
-
static
|
|
171
|
-
static
|
|
172
|
-
static
|
|
173
|
-
static
|
|
174
|
-
static
|
|
182
|
+
private static _useWithPlugin;
|
|
183
|
+
private static _pluginFromBuilder;
|
|
184
|
+
static prop<TThis extends typeof Error0, TKey extends string, TInputValue = undefined, TOutputValue = unknown, TResolveValue extends TOutputValue | undefined = TOutputValue | undefined>(this: TThis, key: TKey, value: ErrorPluginPropOptions<TInputValue, TOutputValue, ErrorInstanceOfMap<PluginsMapOf<TThis>>, TResolveValue>): ClassError0<ExtendErrorPluginsMapWithProp<PluginsMapOf<TThis>, TKey, TInputValue, TOutputValue, TResolveValue>>;
|
|
185
|
+
static method<TThis extends typeof Error0, TKey extends string, TArgs extends unknown[], TOutputValue>(this: TThis, key: TKey, value: ErrorPluginMethodFn<TOutputValue, TArgs, ErrorInstanceOfMap<PluginsMapOf<TThis>>>): ClassError0<ExtendErrorPluginsMapWithMethod<PluginsMapOf<TThis>, TKey, TArgs, TOutputValue>>;
|
|
186
|
+
static adapt<TThis extends typeof Error0>(this: TThis, value: ErrorPluginAdaptFn<ErrorInstanceOfMap<PluginsMapOf<TThis>>, ErrorResolvedProps<PluginsMapOf<TThis>>>): ClassError0<PluginsMapOf<TThis>>;
|
|
187
|
+
static use<TThis extends typeof Error0, TBuilder extends PluginError0>(this: TThis, plugin: TBuilder): ClassError0<ExtendErrorPluginsMap<PluginsMapOf<TThis>, PluginOfBuilder<TBuilder>>>;
|
|
188
|
+
static use<TThis extends typeof Error0, TKey extends string, TInputValue = undefined, TOutputValue = unknown, TResolveValue extends TOutputValue | undefined = TOutputValue | undefined>(this: TThis, kind: 'prop', key: TKey, value: ErrorPluginPropOptions<TInputValue, TOutputValue, ErrorInstanceOfMap<PluginsMapOf<TThis>>, TResolveValue>): ClassError0<ExtendErrorPluginsMapWithProp<PluginsMapOf<TThis>, TKey, TInputValue, TOutputValue, TResolveValue>>;
|
|
189
|
+
static use<TThis extends typeof Error0, TKey extends string, TArgs extends unknown[], TOutputValue>(this: TThis, kind: 'method', key: TKey, value: ErrorPluginMethodFn<TOutputValue, TArgs, ErrorInstanceOfMap<PluginsMapOf<TThis>>>): ClassError0<ExtendErrorPluginsMapWithMethod<PluginsMapOf<TThis>, TKey, TArgs, TOutputValue>>;
|
|
190
|
+
static use<TThis extends typeof Error0>(this: TThis, kind: 'adapt', value: ErrorPluginAdaptFn<ErrorInstanceOfMap<PluginsMapOf<TThis>>, ErrorResolvedProps<PluginsMapOf<TThis>>>): ClassError0<PluginsMapOf<TThis>>;
|
|
191
|
+
static plugin(): PluginError0;
|
|
175
192
|
static serialize(error: unknown, isPublic?: boolean): Record<string, unknown>;
|
|
176
193
|
serialize(isPublic?: boolean): object;
|
|
177
194
|
}
|
|
178
195
|
|
|
179
|
-
export { type ClassError0, Error0, type
|
|
196
|
+
export { type ClassError0, Error0, type ErrorInput, type ErrorInputBase, type ErrorPlugin, type ErrorPluginAdaptFn, type ErrorPluginAdaptResult, type ErrorPluginMethodFn, type ErrorPluginMethods, type ErrorPluginPropOptions, type ErrorPluginProps, type ErrorPluginsMap, type ErrorResolved, type IsEmptyObject, PluginError0 };
|