From 3fe6bc1b82a10bed1d907b749b1cc200659df612 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Tue, 2 Jun 2020 14:24:44 +1000 Subject: fix: Better use of @ts-expect-error (#6038) --- cli/js/error_stack.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'cli/js/error_stack.ts') diff --git a/cli/js/error_stack.ts b/cli/js/error_stack.ts index daf983ba1..39561ad85 100644 --- a/cli/js/error_stack.ts +++ b/cli/js/error_stack.ts @@ -214,7 +214,13 @@ function evaluateCallSite(callSite: CallSite): CallSiteEval { }; } -function prepareStackTrace(error: Error, callSites: CallSite[]): string { +function prepareStackTrace( + error: Error & { + __callSiteEvals: CallSiteEval[]; + __formattedFrames: string[]; + }, + callSites: CallSite[] +): string { const mappedCallSites = callSites.map( (callSite): CallSite => { const fileName = callSite.getFileName(); @@ -238,19 +244,14 @@ function prepareStackTrace(error: Error, callSites: CallSite[]): string { __formattedFrames: { value: [], configurable: true }, }); for (const callSite of mappedCallSites) { - // @ts-expect-error error.__callSiteEvals.push(Object.freeze(evaluateCallSite(callSite))); const isInternal = callSite.getFileName()?.startsWith("$deno$") ?? false; - // @ts-expect-error error.__formattedFrames.push(callSiteToString(callSite, isInternal)); } - // @ts-expect-error Object.freeze(error.__callSiteEvals); - // @ts-expect-error Object.freeze(error.__formattedFrames); return ( `${error.name}: ${error.message}\n` + - // @ts-expect-error error.__formattedFrames .map((s: string) => ` at ${colors.stripColor(s)}`) .join("\n") -- cgit v1.2.3