@devp0nt/error0 1.0.0-next.18 → 1.0.0-next.3

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/src/index.ts CHANGED
@@ -1,11 +1,8 @@
1
1
  import { Meta0 } from '@devp0nt/meta0'
2
- import { meta0PluginTag } from '@devp0nt/meta0/plugins/meta0-plugin-tag'
3
2
  import { type AxiosError, HttpStatusCode, isAxiosError } from 'axios'
4
3
  import get from 'lodash/get.js'
5
4
  import { ZodError } from 'zod'
6
5
 
7
- // TODO: Эррор 0 можно передать и вторым аргументом в логгер, тогда её месадж попадёт в мету, а первый месадж в сам месадж логера
8
- // TODO: Зод, аксиос, это всё плагины
9
6
  // TODO: В эррор0 добавить ориджинал
10
7
  // TODO: store tags as array from all causes
11
8
  // TODO: not use self stack if toError0
@@ -13,59 +10,73 @@ import { ZodError } from 'zod'
13
10
  // TODO: remove defaults prop from getPropsFromUnknown
14
11
  // TODO: code has enum type, fn to check if code exists
15
12
 
16
- const isFilled = <T>(value: T): value is NonNullable<T> => value !== null && value !== undefined && value !== ''
17
- const toStringOrUndefined = (value: unknown): string | undefined => {
18
- return typeof value === 'string' ? value : undefined
19
- }
20
- const toNumberOrUndefined = (value: unknown): number | undefined => {
21
- if (typeof value === 'number') {
22
- return value
23
- }
24
- const number = Number(value)
25
- if (typeof value === 'string' && !Number.isNaN(number)) {
26
- return number
27
- }
28
- return undefined
13
+ export interface Error0Input {
14
+ message?: string
15
+ tag?: string
16
+ code?: string
17
+ httpStatus?: HttpStatusCode | HttpStatusCodeString
18
+ expected?: boolean | ExpectedFn
19
+ clientMessage?: string
20
+ cause?: Error0Cause
21
+ stack?: string
22
+ meta?: Meta0.Meta0OrValueTypeNullish
23
+ zodError?: ZodError
24
+ axiosError?: AxiosError
29
25
  }
30
- const toBooleanOrUndefined = (value: unknown): boolean | undefined => {
31
- if (typeof value === 'boolean') {
32
- return value
33
- }
34
- return undefined
26
+
27
+ interface Error0GeneralProps {
28
+ message: Error0Input['message']
29
+ tag: Error0Input['tag']
30
+ code: Error0Input['code']
31
+ httpStatus: number | undefined
32
+ expected: boolean | undefined
33
+ clientMessage: Error0Input['clientMessage']
34
+ anyMessage: string | undefined
35
+ cause: Error0Input['cause']
36
+ stack: Error['stack']
37
+ meta: Meta0.ValueType
38
+ zodError?: ZodError
39
+ axiosError?: AxiosError
35
40
  }
36
41
 
42
+ type HttpStatusCodeString = keyof typeof HttpStatusCode
43
+ type Error0Cause = Error | Error0 | unknown
44
+ type ExpectedFn = (error: Error0GeneralProps) => boolean | undefined
45
+
46
+ const isFilled = <T>(value: T): value is NonNullable<T> => value !== null && value !== undefined && value !== ''
47
+
37
48
  export class Error0 extends Error {
38
49
  public readonly __I_AM_ERROR_0: true = true
39
50
 
40
- public readonly tag?: Error0.GeneralProps['tag']
41
- public readonly code?: Error0.GeneralProps['code']
42
- public readonly httpStatus?: Error0.GeneralProps['httpStatus']
43
- public readonly expected?: Error0.GeneralProps['expected']
44
- public readonly clientMessage?: Error0.GeneralProps['clientMessage']
45
- public readonly anyMessage?: Error0.GeneralProps['anyMessage']
46
- public override readonly cause?: Error0.GeneralProps['cause']
47
- public readonly meta?: Meta0.ValueTypeNullish
48
- public readonly zodError?: Error0.GeneralProps['zodError']
49
- public readonly axiosError?: Error0.GeneralProps['axiosError']
51
+ public readonly tag?: Error0GeneralProps['tag']
52
+ public readonly code?: Error0GeneralProps['code']
53
+ public readonly httpStatus?: Error0GeneralProps['httpStatus']
54
+ public readonly expected?: Error0GeneralProps['expected']
55
+ public readonly clientMessage?: Error0GeneralProps['clientMessage']
56
+ public readonly anyMessage?: Error0GeneralProps['anyMessage']
57
+ public override readonly cause?: Error0GeneralProps['cause']
58
+ public readonly meta?: Meta0.Meta0OrValueTypeNullish
59
+ public readonly zodError?: Error0GeneralProps['zodError']
60
+ public readonly axiosError?: Error0GeneralProps['axiosError']
50
61
 
51
62
  static defaultMessage = 'Unknown error'
52
- static defaultCode?: Error0.GeneralProps['code']
53
- static defaultHttpStatus?: Error0.GeneralProps['httpStatus']
54
- static defaultExpected?: Error0.GeneralProps['expected']
55
- static defaultClientMessage?: Error0.GeneralProps['clientMessage']
63
+ static defaultCode?: Error0GeneralProps['code']
64
+ static defaultHttpStatus?: Error0GeneralProps['httpStatus']
65
+ static defaultExpected?: Error0GeneralProps['expected']
66
+ static defaultClientMessage?: Error0GeneralProps['clientMessage']
56
67
  static defaultMeta?: Meta0.Meta0OrValueTypeNullish
57
68
 
58
- public readonly propsOriginal: Error0.GeneralProps
69
+ public readonly propsOriginal: Error0GeneralProps
59
70
 
60
71
  constructor(message: string)
61
- constructor(input: Error0.Input)
62
- constructor(message: string, input: Error0.Input)
72
+ constructor(input: Error0Input)
73
+ constructor(message: string, input: Error0Input)
63
74
  constructor(error: Error)
64
- constructor(error: Error, input: Error0.Input)
75
+ constructor(error: Error, input: Error0Input)
65
76
  constructor(value: unknown)
66
- constructor(value: unknown, input: Error0.Input)
77
+ constructor(value: unknown, input: Error0Input)
67
78
  constructor(...args: unknown[]) {
68
- const input: Partial<Error0.Input> = {}
79
+ const input: Partial<Error0Input> = {}
69
80
  if (args[0] instanceof Error) {
70
81
  input.cause = args[0]
71
82
  } else if (typeof args[0] === 'object' && args[0] !== null) {
@@ -111,8 +122,8 @@ export class Error0 extends Error {
111
122
 
112
123
  // props
113
124
 
114
- public static _safeParseInput(error0Input: Record<string, unknown>): Error0.Input {
115
- const result: Error0.Input = {}
125
+ public static _safeParseInput(error0Input: Record<string, unknown>): Error0Input {
126
+ const result: Error0Input = {}
116
127
  result.message = typeof error0Input.message === 'string' ? error0Input.message : undefined
117
128
  result.tag = typeof error0Input.tag === 'string' ? error0Input.tag : undefined
118
129
  result.code = typeof error0Input.code === 'string' ? error0Input.code : undefined
@@ -149,27 +160,19 @@ export class Error0 extends Error {
149
160
  message,
150
161
  stack,
151
162
  }: {
152
- error0Input: Error0.Input
163
+ error0Input: Error0Input
153
164
  message: string
154
- stack: Error0.GeneralProps['stack']
155
- }): Error0.GeneralProps {
165
+ stack: Error0GeneralProps['stack']
166
+ }): Error0GeneralProps {
156
167
  // const meta = Meta0.merge(error0Input.meta0, error0Input.meta).value
157
-
158
- // const meta0 = Meta0.extend(error0Input.meta, this.defaultMeta)
159
- // const defaultMetaValue =
160
- // this.defaultMeta && typeof this.defaultMeta === 'object' && 'getValue' in this.defaultMeta
161
- // ? (this.defaultMeta as any).getValue()
162
- // : this.defaultMeta
163
-
164
- const meta0 = Meta0.extend(this.defaultMeta, error0Input.meta)
168
+ const meta0 = Meta0.extend(error0Input.meta, this.defaultMeta)
165
169
  const meta = meta0.getValue()
166
- const finalTag = meta0PluginTag.public.getFullTag(meta0, error0Input.tag)
167
- delete meta.tagPrefix
170
+ const finalTag = meta0.getFinalTag(error0Input.tag)
168
171
  const clientMessage = error0Input.clientMessage || this.defaultClientMessage
169
- const result: Error0.GeneralProps = {
172
+ const result: Error0GeneralProps = {
170
173
  message: error0Input.message || this.defaultMessage,
171
174
  tag: finalTag,
172
- code: error0Input.code || toStringOrUndefined(meta.code) || this.defaultCode,
175
+ code: error0Input.code || meta.code || this.defaultCode,
173
176
  httpStatus:
174
177
  typeof error0Input.httpStatus === 'number'
175
178
  ? error0Input.httpStatus
@@ -177,7 +180,7 @@ export class Error0 extends Error {
177
180
  typeof error0Input.httpStatus === 'string' &&
178
181
  error0Input.httpStatus in HttpStatusCode
179
182
  ? HttpStatusCode[error0Input.httpStatus]
180
- : toNumberOrUndefined(meta.httpStatus) || this.defaultHttpStatus,
183
+ : meta.httpStatus || this.defaultHttpStatus,
181
184
  expected: undefined,
182
185
  clientMessage,
183
186
  anyMessage: clientMessage || message,
@@ -191,19 +194,19 @@ export class Error0 extends Error {
191
194
  result,
192
195
  typeof error0Input.expected === 'boolean' || typeof error0Input.expected === 'function'
193
196
  ? error0Input.expected
194
- : toBooleanOrUndefined(meta.expected) || this.defaultExpected,
197
+ : meta.expected || this.defaultExpected,
195
198
  )
196
199
  result.stack = this._removeConstructorStackPart(stack)
197
200
  return result
198
201
  }
199
202
 
200
- public static _getSelfPropsFloated(causesProps: Error0.GeneralProps[]): Error0.GeneralProps {
203
+ public static _getSelfPropsFloated(causesProps: Error0GeneralProps[]): Error0GeneralProps {
201
204
  const cause = this._getClosestPropValue(causesProps, 'cause')
202
205
  const stack = this._mergeStack(causesProps[1]?.stack, causesProps[0]?.stack)
203
206
  const closestTag = this._getClosestPropValue(causesProps, 'tag')
204
207
  const meta = this._getMergedMetaValue(causesProps)
205
- const tag = meta0PluginTag.public.getFullTag(meta, closestTag)
206
- const propsFloated: Error0.GeneralProps = {
208
+ const tag = Meta0.getFinalTag(meta, closestTag)
209
+ const propsFloated: Error0GeneralProps = {
207
210
  message: this._getClosestPropValue(causesProps, 'message'),
208
211
  tag,
209
212
  code: this._getClosestPropValue(causesProps, 'code'),
@@ -222,13 +225,13 @@ export class Error0 extends Error {
222
225
 
223
226
  // sepcial
224
227
 
225
- public static _getExtraError0PropsByZodError(zodError: ZodError): Partial<Error0.GeneralProps> {
228
+ public static _getExtraError0PropsByZodError(zodError: ZodError): Partial<Error0GeneralProps> {
226
229
  return {
227
230
  message: `Zod Validation Error: ${zodError.message}`,
228
231
  }
229
232
  }
230
233
 
231
- public static _getExtraError0PropsByAxiosError(axiosError: AxiosError): Partial<Error0.GeneralProps> {
234
+ public static _getExtraError0PropsByAxiosError(axiosError: AxiosError): Partial<Error0GeneralProps> {
232
235
  return {
233
236
  message: 'Axios Error',
234
237
  meta: {
@@ -245,8 +248,8 @@ export class Error0 extends Error {
245
248
  }
246
249
 
247
250
  public static _assignError0Props(
248
- error0Props: Error0.GeneralProps,
249
- extraError0Props: Partial<Error0.GeneralProps>,
251
+ error0Props: Error0GeneralProps,
252
+ extraError0Props: Partial<Error0GeneralProps>,
250
253
  ): void {
251
254
  const metaValue = Meta0.mergeValues(error0Props.meta, extraError0Props.meta)
252
255
  Object.assign(error0Props, extraError0Props, { meta: metaValue })
@@ -255,8 +258,8 @@ export class Error0 extends Error {
255
258
  // expected
256
259
 
257
260
  public static _normalizeSelfExpected(
258
- error0Props: Error0.GeneralProps,
259
- expectedProvided: Error0.Input['expected'],
261
+ error0Props: Error0GeneralProps,
262
+ expectedProvided: Error0Input['expected'],
260
263
  ): boolean | undefined {
261
264
  if (typeof expectedProvided === 'function') {
262
265
  return expectedProvided(error0Props)
@@ -264,7 +267,7 @@ export class Error0 extends Error {
264
267
  return expectedProvided
265
268
  }
266
269
 
267
- public static _isExpected(causesProps: Error0.GeneralProps[]): boolean {
270
+ public static _isExpected(causesProps: Error0GeneralProps[]): boolean {
268
271
  let hasExpectedTrue = false
269
272
  for (const causeProps of causesProps) {
270
273
  if (causeProps.expected === false) {
@@ -279,7 +282,7 @@ export class Error0 extends Error {
279
282
 
280
283
  // getters
281
284
 
282
- public static _getPropsFromUnknown(error: unknown, defaults?: Error0.Input): Error0.GeneralProps {
285
+ public static _getPropsFromUnknown(error: unknown, defaults?: Error0Input): Error0GeneralProps {
283
286
  if (typeof error !== 'object' || error === null) {
284
287
  return {
285
288
  message: undefined,
@@ -301,7 +304,7 @@ export class Error0 extends Error {
301
304
  'clientMessage' in error && typeof error.clientMessage === 'string'
302
305
  ? error.clientMessage
303
306
  : defaults?.clientMessage || undefined
304
- const result: Error0.GeneralProps = {
307
+ const result: Error0GeneralProps = {
305
308
  message,
306
309
  code: 'code' in error && typeof error.code === 'string' ? error.code : defaults?.code || undefined,
307
310
  clientMessage,
@@ -336,7 +339,7 @@ export class Error0 extends Error {
336
339
  result.expected = this._normalizeSelfExpected(
337
340
  result,
338
341
  'expected' in error && (typeof error.expected === 'boolean' || typeof error.expected === 'function')
339
- ? (error.expected as Error0.ExpectedFn)
342
+ ? (error.expected as ExpectedFn)
340
343
  : defaults?.expected || undefined,
341
344
  )
342
345
  if (result.zodError) {
@@ -348,12 +351,12 @@ export class Error0 extends Error {
348
351
  return result
349
352
  }
350
353
 
351
- public static _getCausesPropsFromUnknown(error: unknown, maxLevel: number): Error0.GeneralProps[] {
354
+ public static _getCausesPropsFromUnknown(error: unknown, maxLevel: number): Error0GeneralProps[] {
352
355
  if (!error) {
353
356
  return []
354
357
  }
355
358
  const causeProps = this._getPropsFromUnknown(error)
356
- const causesProps: Error0.GeneralProps[] = [causeProps]
359
+ const causesProps: Error0GeneralProps[] = [causeProps]
357
360
  if (!causeProps.cause) {
358
361
  return causesProps
359
362
  }
@@ -364,28 +367,28 @@ export class Error0 extends Error {
364
367
  }
365
368
 
366
369
  public static _getCausesPropsFromError0Props(
367
- error0Props: Error0.GeneralProps,
370
+ error0Props: Error0GeneralProps,
368
371
  maxLevel: number,
369
- ): Error0.GeneralProps[] {
372
+ ): Error0GeneralProps[] {
370
373
  return [error0Props, ...this._getCausesPropsFromUnknown(error0Props.cause, maxLevel - 1)]
371
374
  }
372
375
 
373
- public static _getClosestPropValue<TPropKey extends keyof Error0.GeneralProps>(
374
- causesProps: Error0.GeneralProps[],
376
+ public static _getClosestPropValue<TPropKey extends keyof Error0GeneralProps>(
377
+ causesProps: Error0GeneralProps[],
375
378
  propKey: TPropKey,
376
- ): NonNullable<Error0.GeneralProps[TPropKey]> | undefined {
379
+ ): NonNullable<Error0GeneralProps[TPropKey]> | undefined {
377
380
  for (const causeProps of causesProps) {
378
381
  const propValue = causeProps[propKey]
379
382
  if (isFilled(propValue)) {
380
- return propValue as NonNullable<Error0.GeneralProps[TPropKey]>
383
+ return propValue as NonNullable<Error0GeneralProps[TPropKey]>
381
384
  }
382
385
  }
383
386
  return undefined
384
387
  }
385
388
 
386
389
  // private static getClosestByGetter<TResult>(
387
- // causesProps: Error0.GeneralProps[],
388
- // getter: (props: Error0.GeneralProps) => TResult,
390
+ // causesProps: Error0GeneralProps[],
391
+ // getter: (props: Error0GeneralProps) => TResult,
389
392
  // ): NonNullable<TResult> | undefined {
390
393
  // for (const causeProps of causesProps) {
391
394
  // const result = getter(causeProps)
@@ -396,21 +399,21 @@ export class Error0 extends Error {
396
399
  // return undefined
397
400
  // }
398
401
 
399
- public static _getFilledPropValues<TPropKey extends keyof Error0.Input>(
400
- causesProps: Error0.GeneralProps[],
402
+ public static _getFilledPropValues<TPropKey extends keyof Error0Input>(
403
+ causesProps: Error0GeneralProps[],
401
404
  propKey: TPropKey,
402
- ): NonNullable<Error0.GeneralProps[TPropKey]>[] {
403
- const values: NonNullable<Error0.GeneralProps[TPropKey]>[] = []
405
+ ): NonNullable<Error0GeneralProps[TPropKey]>[] {
406
+ const values: NonNullable<Error0GeneralProps[TPropKey]>[] = []
404
407
  for (const causeProps of causesProps) {
405
408
  const propValue = causeProps[propKey]
406
409
  if (isFilled(propValue)) {
407
- values.push(propValue as NonNullable<Error0.GeneralProps[TPropKey]>)
410
+ values.push(propValue as NonNullable<Error0GeneralProps[TPropKey]>)
408
411
  }
409
412
  }
410
413
  return values
411
414
  }
412
415
 
413
- public static _getMergedMetaValue(causesProps: Error0.GeneralProps[]): Meta0.ValueType {
416
+ public static _getMergedMetaValue(causesProps: Error0GeneralProps[]): Meta0.ValueType {
414
417
  const metas = this._getFilledPropValues(causesProps, 'meta')
415
418
  if (metas.length === 0) {
416
419
  return {}
@@ -423,7 +426,7 @@ export class Error0 extends Error {
423
426
 
424
427
  // stack
425
428
 
426
- public static _removeConstructorStackPart(stack: Error0.GeneralProps['stack']): Error0.GeneralProps['stack'] {
429
+ public static _removeConstructorStackPart(stack: Error0GeneralProps['stack']): Error0GeneralProps['stack'] {
427
430
  if (!stack) {
428
431
  return stack
429
432
  }
@@ -439,9 +442,9 @@ export class Error0 extends Error {
439
442
  }
440
443
 
441
444
  public static _mergeStack(
442
- prevStack: Error0.GeneralProps['stack'],
443
- nextStack: Error0.GeneralProps['stack'],
444
- ): Error0.GeneralProps['stack'] {
445
+ prevStack: Error0GeneralProps['stack'],
446
+ nextStack: Error0GeneralProps['stack'],
447
+ ): Error0GeneralProps['stack'] {
445
448
  return [nextStack, prevStack].filter(Boolean).join('\n\n') || undefined
446
449
  }
447
450
 
@@ -465,7 +468,7 @@ export class Error0 extends Error {
465
468
  return false
466
469
  }
467
470
 
468
- public static _toError0(error: unknown, inputOverride: Error0.Input = {}): Error0 {
471
+ public static _toError0(error: unknown, inputOverride: Error0Input = {}): Error0 {
469
472
  if (error instanceof Error0) {
470
473
  return error
471
474
  }
@@ -498,16 +501,16 @@ export class Error0 extends Error {
498
501
  return new Error0(this._getPropsFromUnknown(error, inputOverride))
499
502
  }
500
503
 
501
- static from(error: unknown, inputOverride?: Error0.Input): Error0 {
504
+ static from(error: unknown, inputOverride?: Error0Input): Error0 {
502
505
  return this._toError0(error, inputOverride)
503
506
  }
504
507
 
505
508
  static extend(props: {
506
- defaultMessage?: Error0.GeneralProps['message']
507
- defaultCode?: Error0.GeneralProps['code']
508
- defaultHttpStatus?: Error0.GeneralProps['httpStatus']
509
- defaultExpected?: Error0.GeneralProps['expected']
510
- defaultClientMessage?: Error0.GeneralProps['clientMessage']
509
+ defaultMessage?: Error0GeneralProps['message']
510
+ defaultCode?: Error0GeneralProps['code']
511
+ defaultHttpStatus?: Error0GeneralProps['httpStatus']
512
+ defaultExpected?: Error0GeneralProps['expected']
513
+ defaultClientMessage?: Error0GeneralProps['clientMessage']
511
514
  defaultMeta?: Meta0.Meta0OrValueTypeNullish
512
515
  }) {
513
516
  const parent = this
@@ -517,18 +520,18 @@ export class Error0 extends Error {
517
520
  static override defaultHttpStatus = props.defaultHttpStatus ?? parent.defaultHttpStatus
518
521
  static override defaultExpected = props.defaultExpected ?? parent.defaultExpected
519
522
  static override defaultClientMessage = props.defaultClientMessage ?? parent.defaultClientMessage
520
- static override defaultMeta = Meta0.extend(parent.defaultMeta, props.defaultMeta)
523
+ static override defaultMeta = Meta0.extend(props.defaultMeta, parent.defaultMeta)
521
524
  }
522
525
  }
523
526
 
524
527
  static extendCollection<T extends Record<string, typeof Error0>>(
525
528
  classes: T,
526
529
  props: {
527
- defaultMessage?: Error0.GeneralProps['message']
528
- defaultCode?: Error0.GeneralProps['code']
529
- defaultHttpStatus?: Error0.GeneralProps['httpStatus']
530
- defaultExpected?: Error0.GeneralProps['expected']
531
- defaultClientMessage?: Error0.GeneralProps['clientMessage']
530
+ defaultMessage?: Error0GeneralProps['message']
531
+ defaultCode?: Error0GeneralProps['code']
532
+ defaultHttpStatus?: Error0GeneralProps['httpStatus']
533
+ defaultExpected?: Error0GeneralProps['expected']
534
+ defaultClientMessage?: Error0GeneralProps['clientMessage']
532
535
  defaultMeta?: Meta0.Meta0OrValueTypeNullish
533
536
  },
534
537
  ): T {
@@ -550,7 +553,7 @@ export class Error0 extends Error {
550
553
  __I_AM_ERROR_0: this.__I_AM_ERROR_0,
551
554
  }
552
555
  }
553
- static toJSON(error: unknown, inputOverride?: Error0.Input) {
556
+ static toJSON(error: unknown, inputOverride?: Error0Input) {
554
557
  const error0 = this.from(error, inputOverride)
555
558
  return error0.toJSON()
556
559
  }
@@ -570,38 +573,13 @@ export class Error0 extends Error {
570
573
  }
571
574
 
572
575
  export namespace Error0 {
573
- export interface Input {
574
- message?: string
575
- tag?: string
576
- code?: string
577
- httpStatus?: HttpStatusCode | HttpStatusCodeString
578
- expected?: boolean | Error0.ExpectedFn
579
- clientMessage?: string
580
- cause?: Error0Cause
581
- stack?: string
582
- meta?: Meta0.Meta0OrValueTypeNullish
583
- zodError?: ZodError
584
- axiosError?: AxiosError
585
- }
586
-
587
- export interface GeneralProps {
588
- message: Input['message']
589
- tag: Input['tag']
590
- code: Input['code']
591
- httpStatus: number | undefined
592
- expected: boolean | undefined
593
- clientMessage: Input['clientMessage']
594
- anyMessage: string | undefined
595
- cause: Input['cause']
596
- stack: Error['stack']
597
- meta: Meta0.ValueType
598
- zodError?: ZodError
599
- axiosError?: AxiosError
600
- }
601
-
602
- export type HttpStatusCodeString = keyof typeof HttpStatusCode
603
- export type Error0Cause = Error | Error0 | unknown
604
- export type ExpectedFn = (error: GeneralProps) => boolean | undefined
605
576
  export type JSON = ReturnType<Error0['toJSON']>
606
577
  export type Collection = Record<string, typeof Error0>
607
578
  }
579
+
580
+ export const e0s = {
581
+ Default: Error0,
582
+ Expected: Error0.extend({
583
+ defaultExpected: true,
584
+ }) as typeof Error0,
585
+ } satisfies Error0.Collection