diff options
Diffstat (limited to 'cli/js')
-rw-r--r-- | cli/js/error_stack.ts | 13 | ||||
-rw-r--r-- | cli/js/repl.ts | 4 | ||||
-rw-r--r-- | cli/js/runtime_main.ts | 8 | ||||
-rw-r--r-- | cli/js/runtime_worker.ts | 8 | ||||
-rw-r--r-- | cli/js/testing.ts | 4 | ||||
-rw-r--r-- | cli/js/web/console.ts | 26 | ||||
-rw-r--r-- | cli/js/web/fetch.ts | 3 | ||||
-rw-r--r-- | cli/js/web/timers.ts | 4 |
8 files changed, 37 insertions, 33 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") diff --git a/cli/js/repl.ts b/cli/js/repl.ts index f38324d11..d1cf63cd9 100644 --- a/cli/js/repl.ts +++ b/cli/js/repl.ts @@ -35,8 +35,8 @@ function isRecoverableError(e: Error): boolean { // Returns `true` if `close()` is called in REPL. // We should quit the REPL when this function returns `true`. function isCloseCalled(): boolean { - // @ts-expect-error - return globalThis.closed; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (globalThis as any).closed; } // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/cli/js/runtime_main.ts b/cli/js/runtime_main.ts index 97205d205..58405f673 100644 --- a/cli/js/runtime_main.ts +++ b/cli/js/runtime_main.ts @@ -30,8 +30,8 @@ import { log, immutableDefine } from "./util.ts"; // TODO: factor out `Deno` global assignment to separate function // Add internal object to Deno object. // This is not exposed as part of the Deno types. -// @ts-expect-error -denoNs[internalSymbol] = internalObject; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +(denoNs as any)[internalSymbol] = internalObject; let windowIsClosing = false; @@ -71,8 +71,8 @@ export function bootstrapMainRuntime(): void { throw new Error("Worker runtime already bootstrapped"); } // Remove bootstrapping methods from global scope - // @ts-expect-error - globalThis.bootstrap = undefined; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (globalThis as any).bootstrap = undefined; log("bootstrapMainRuntime"); hasBootstrapped = true; Object.defineProperties(globalThis, windowOrWorkerGlobalScopeMethods); diff --git a/cli/js/runtime_worker.ts b/cli/js/runtime_worker.ts index 4e92663a1..3f7816990 100644 --- a/cli/js/runtime_worker.ts +++ b/cli/js/runtime_worker.ts @@ -33,8 +33,8 @@ import { setSignals } from "./signals.ts"; // TODO: factor out `Deno` global assignment to separate function // Add internal object to Deno object. // This is not exposed as part of the Deno types. -// @ts-expect-error -denoNs[internalSymbol] = internalObject; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +(denoNs as any)[internalSymbol] = internalObject; const encoder = new TextEncoder(); @@ -128,8 +128,8 @@ export function bootstrapWorkerRuntime( throw new Error("Worker runtime already bootstrapped"); } // Remove bootstrapping methods from global scope - // @ts-expect-error - globalThis.bootstrap = undefined; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (globalThis as any).bootstrap = undefined; log("bootstrapWorkerRuntime"); hasBootstrapped = true; Object.defineProperties(globalThis, windowOrWorkerGlobalScopeMethods); diff --git a/cli/js/testing.ts b/cli/js/testing.ts index fc32fd604..ffe978888 100644 --- a/cli/js/testing.ts +++ b/cli/js/testing.ts @@ -336,8 +336,8 @@ async function runTests({ const originalConsole = globalThis.console; if (disableLog) { - // @ts-expect-error - globalThis.console = disabledConsole; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (globalThis as any).console = disabledConsole; } let endMsg: TestMessage["end"]; diff --git a/cli/js/web/console.ts b/cli/js/web/console.ts index 4b5423631..9f166b373 100644 --- a/cli/js/web/console.ts +++ b/cli/js/web/console.ts @@ -216,14 +216,18 @@ function groupEntries<T>( lineMaxLength += separatorSpace; maxLineLength[i] = lineMaxLength; } - let order = "padStart"; + let order: "padStart" | "padEnd" = "padStart"; if (value !== undefined) { for (let i = 0; i < entries.length; i++) { - //@ts-expect-error - if (typeof value[i] !== "number" && typeof value[i] !== "bigint") { + /* eslint-disable @typescript-eslint/no-explicit-any */ + if ( + typeof (value as any)[i] !== "number" && + typeof (value as any)[i] !== "bigint" + ) { order = "padEnd"; break; } + /* eslint-enable */ } } // Each iteration creates a single line of grouped entries. @@ -235,7 +239,6 @@ function groupEntries<T>( for (; j < max - 1; j++) { // In future, colors should be taken here into the account const padding = maxLineLength[j - i]; - //@ts-expect-error str += `${entries[j]}, `[order](padding, " "); } if (order === "padStart") { @@ -408,8 +411,8 @@ function createMapString( }, group: false, }; - //@ts-expect-error - return createIterableString(value, ctx, level, maxLevel, printConfig); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return createIterableString(value as any, ctx, level, maxLevel, printConfig); } function createWeakSetString(): string { @@ -477,7 +480,7 @@ function createPromiseString( // TODO: Proxy function createRawObjectString( - value: { [key: string]: unknown }, + value: Record<string, unknown>, ctx: ConsoleContext, level: number, maxLevel: number @@ -490,8 +493,9 @@ function createRawObjectString( let baseString = ""; let shouldShowDisplayName = false; - // @ts-expect-error - let displayName = value[Symbol.toStringTag]; + let displayName = (value as { [Symbol.toStringTag]: string })[ + Symbol.toStringTag + ]; if (!displayName) { displayName = getClassInstanceName(value); } @@ -511,8 +515,8 @@ function createRawObjectString( for (const key of symbolKeys) { entries.push( `${key.toString()}: ${stringifyWithQuotes( - // @ts-expect-error - value[key], + // eslint-disable-next-line @typescript-eslint/no-explicit-any + value[key as any], ctx, level + 1, maxLevel diff --git a/cli/js/web/fetch.ts b/cli/js/web/fetch.ts index c63fa698f..1f0242a96 100644 --- a/cli/js/web/fetch.ts +++ b/cli/js/web/fetch.ts @@ -187,7 +187,7 @@ function sendFetchReq( } export async function fetch( - input: domTypes.Request | URL | string, + input: (domTypes.Request & { _bodySource?: unknown }) | URL | string, init?: domTypes.RequestInit ): Promise<Response> { let url: string; @@ -285,7 +285,6 @@ export async function fetch( method = input.method; headers = input.headers; - //@ts-expect-error if (input._bodySource) { body = new DataView(await input.arrayBuffer()); } diff --git a/cli/js/web/timers.ts b/cli/js/web/timers.ts index 87b23de06..245d6a8c7 100644 --- a/cli/js/web/timers.ts +++ b/cli/js/web/timers.ts @@ -234,23 +234,23 @@ function setTimer( } export function setTimeout( + this: unknown, cb: (...args: Args) => void, delay = 0, ...args: Args ): number { checkBigInt(delay); - // @ts-expect-error checkThis(this); return setTimer(cb, delay, args, false); } export function setInterval( + this: unknown, cb: (...args: Args) => void, delay = 0, ...args: Args ): number { checkBigInt(delay); - // @ts-expect-error checkThis(this); return setTimer(cb, delay, args, true); } |