From 554ba9f0840bf59de2dc2e98fb6bdd1b293a3413 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Sat, 17 Dec 2022 06:36:26 +0100 Subject: [PATCH] fix: RollupLog cause allow unknown (#4757) * fix: RollupLog cause allow unknown * fix access to cause.name Co-authored-by: Lukas Taegert-Atkinson --- cli/logging.ts | 2 +- src/rollup/types.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/logging.ts b/cli/logging.ts index fd1100c51f4..c58bab77d41 100644 --- a/cli/logging.ts +++ b/cli/logging.ts @@ -8,7 +8,7 @@ export const stderr = (...parameters: readonly unknown[]) => process.stderr.write(`${parameters.join('')}\n`); export function handleError(error: RollupError, recover = false): void { - const name = error.name || error.cause?.name; + const name = error.name || (error.cause as Error)?.name; const nameSection = name ? `${name}: ` : ''; const pluginSection = error.plugin ? `(plugin ${error.plugin}) ` : ''; const message = `${pluginSection}${nameSection}${error.message}`; diff --git a/src/rollup/types.d.ts b/src/rollup/types.d.ts index 1c35370a821..103e6b6e9e5 100644 --- a/src/rollup/types.d.ts +++ b/src/rollup/types.d.ts @@ -19,7 +19,7 @@ export type RollupWarning = RollupLog; export interface RollupLog { binding?: string; - cause?: Error; + cause?: unknown; code?: string; exporter?: string; frame?: string;