From 0c9ba5ecb44fb55c69399b53ea893cba9541768a Mon Sep 17 00:00:00 2001 From: Holger Drewes Date: Fri, 27 May 2022 09:18:48 +0200 Subject: [PATCH] Block: allow sub class error to take on the type shapes of the generic error by unionizing the types --- packages/block/src/errors.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/block/src/errors.ts b/packages/block/src/errors.ts index df98cda3f6..c12814bd59 100644 --- a/packages/block/src/errors.ts +++ b/packages/block/src/errors.ts @@ -1,5 +1,7 @@ import { UsageError, ValidationError } from '@ethereumjs/util' +import type { ValidationErrorType } from '@ethereumjs/util' + /** * Always define error codes on the generic Util * error class level (e.g. associated to `ValidationError`) @@ -12,10 +14,12 @@ export enum ValidationErrorCode { * Additional types extending the generic Util * error types (e.g. `ValidationErrorType`) */ -export type HeaderValidationErrorType = { - block: string - received: string -} +export type HeaderValidationErrorType = + | { + block: string + received: string + } + | ValidationErrorType export type HeaderUsageErrorType = { block: string }