summaryrefslogtreecommitdiff
path: root/cli/js/error_stack.ts
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-06-02 14:24:44 +1000
committerGitHub <noreply@github.com>2020-06-02 00:24:44 -0400
commit3fe6bc1b82a10bed1d907b749b1cc200659df612 (patch)
tree02e14128039d015a7256494a50476f61785e6f33 /cli/js/error_stack.ts
parent8b1b4766a1e747437a2b88fcadc26162a1bec640 (diff)
fix: Better use of @ts-expect-error (#6038)
Diffstat (limited to 'cli/js/error_stack.ts')
-rw-r--r--cli/js/error_stack.ts13
1 files changed, 7 insertions, 6 deletions
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")