From d1019659f59829437298a250ea6d665e7aaf84c5 Mon Sep 17 00:00:00 2001 From: Elijah Duffy Date: Tue, 21 Apr 2026 18:08:57 -0700 Subject: [PATCH] ErrorMessage: accept unknown in constructor --- src/lib/error.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/error.ts b/src/lib/error.ts index 24de6bc..ab5cad1 100644 --- a/src/lib/error.ts +++ b/src/lib/error.ts @@ -78,7 +78,7 @@ export class ErrorMessage { * @param errors The raw errors to convert and store, or null/undefined for no error. * @throws If any of the raw errors are of an unsupported type. */ - constructor(...errors: (RawError | null | undefined)[]) { + constructor(...errors: (unknown | null | undefined)[]) { if (errors.length === 0) return; this._lines = errors.flatMap((e) => ErrorMessage.rawErrorToLines(e)); } @@ -87,7 +87,7 @@ export class ErrorMessage { * Creates a new ErrorMessage only if the provided errors are not null or * undefined. If no errors are provided, returns null. */ - static from(...errors: (RawError | null | undefined)[]): ErrorMessage | null { + static from(...errors: (unknown | null | undefined)[]): ErrorMessage | null { if (errors.length === 0) return null; return new ErrorMessage(...errors); } @@ -97,7 +97,7 @@ export class ErrorMessage { * @param errors The raw errors to wrap around this error, or null/undefined for no additional error. * @returns A new ErrorMessage instance that includes the original error and any new errors. */ - wrap(...errors: (RawError | null | undefined)[]): ErrorMessage { + wrap(...errors: (unknown | null | undefined)[]): ErrorMessage { if (errors.length === 0) return this; const newLines = errors.flatMap((e) => ErrorMessage.rawErrorToLines(e)); return new ErrorMessage(...newLines, ...this._lines); @@ -122,7 +122,7 @@ export class ErrorMessage { } /** converts a RawError to an array of lines */ - static rawErrorToLines(raw: RawError | null | undefined): string[] { + static rawErrorToLines(raw: unknown | null | undefined): string[] { if (!raw) return []; let errorLines: string[];