diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2020-05-27 00:02:16 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-26 10:02:16 -0400 |
commit | 228f9c207f8320908325a553c96e465da08fc617 (patch) | |
tree | 54f2aba9f577d713dcbed5882ae7ae9e53c7baaf /cli/js | |
parent | 24c36fd8625df6b276108109478a62b4661a0b3f (diff) |
Use ts-expect-error instead of ts-ignore. (#5869)
Diffstat (limited to 'cli/js')
-rw-r--r-- | cli/js/error_stack.ts | 8 | ||||
-rw-r--r-- | cli/js/repl.ts | 2 | ||||
-rw-r--r-- | cli/js/runtime_main.ts | 4 | ||||
-rw-r--r-- | cli/js/runtime_worker.ts | 4 | ||||
-rw-r--r-- | cli/js/testing.ts | 4 | ||||
-rw-r--r-- | cli/js/web/body.ts | 2 | ||||
-rw-r--r-- | cli/js/web/console.ts | 12 | ||||
-rw-r--r-- | cli/js/web/fetch.ts | 2 | ||||
-rw-r--r-- | cli/js/web/timers.ts | 4 |
9 files changed, 19 insertions, 23 deletions
diff --git a/cli/js/error_stack.ts b/cli/js/error_stack.ts index e77f0865c..8a3d0530b 100644 --- a/cli/js/error_stack.ts +++ b/cli/js/error_stack.ts @@ -244,19 +244,19 @@ function prepareStackTrace( } ) .map((callSite): string => { - // @ts-ignore + // @ts-expect-error error.__callSiteEvals.push(Object.freeze(evaluateCallSite(callSite))); const isInternal = callSite.getFileName()?.startsWith("$deno$") ?? false; const string = callSiteToString(callSite, isInternal); - // @ts-ignore + // @ts-expect-error error.__formattedFrames.push(string); return ` at ${colors.stripColor(string)}`; }) .join("\n"); - // @ts-ignore + // @ts-expect-error Object.freeze(error.__callSiteEvals); - // @ts-ignore + // @ts-expect-error Object.freeze(error.__formattedFrames); return errorString; } diff --git a/cli/js/repl.ts b/cli/js/repl.ts index c84be68b1..79273ed33 100644 --- a/cli/js/repl.ts +++ b/cli/js/repl.ts @@ -35,7 +35,7 @@ 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-ignore + // @ts-expect-error return globalThis.closed; } diff --git a/cli/js/runtime_main.ts b/cli/js/runtime_main.ts index 3e81fc680..97205d205 100644 --- a/cli/js/runtime_main.ts +++ b/cli/js/runtime_main.ts @@ -30,7 +30,7 @@ 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-ignore +// @ts-expect-error denoNs[internalSymbol] = internalObject; let windowIsClosing = false; @@ -71,7 +71,7 @@ export function bootstrapMainRuntime(): void { throw new Error("Worker runtime already bootstrapped"); } // Remove bootstrapping methods from global scope - // @ts-ignore + // @ts-expect-error globalThis.bootstrap = undefined; log("bootstrapMainRuntime"); hasBootstrapped = true; diff --git a/cli/js/runtime_worker.ts b/cli/js/runtime_worker.ts index ed735fd52..4e92663a1 100644 --- a/cli/js/runtime_worker.ts +++ b/cli/js/runtime_worker.ts @@ -33,7 +33,7 @@ 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-ignore +// @ts-expect-error denoNs[internalSymbol] = internalObject; const encoder = new TextEncoder(); @@ -128,7 +128,7 @@ export function bootstrapWorkerRuntime( throw new Error("Worker runtime already bootstrapped"); } // Remove bootstrapping methods from global scope - // @ts-ignore + // @ts-expect-error globalThis.bootstrap = undefined; log("bootstrapWorkerRuntime"); hasBootstrapped = true; diff --git a/cli/js/testing.ts b/cli/js/testing.ts index 09acdc23d..fc32fd604 100644 --- a/cli/js/testing.ts +++ b/cli/js/testing.ts @@ -333,11 +333,10 @@ async function runTests({ const filterFn = createFilterFn(filter, skip); const testApi = new TestApi(TEST_REGISTRY, filterFn, failFast); - // @ts-ignore const originalConsole = globalThis.console; if (disableLog) { - // @ts-ignore + // @ts-expect-error globalThis.console = disabledConsole; } @@ -356,7 +355,6 @@ async function runTests({ } if (disableLog) { - // @ts-ignore globalThis.console = originalConsole; } diff --git a/cli/js/web/body.ts b/cli/js/web/body.ts index 9c4997755..ffe3f0e59 100644 --- a/cli/js/web/body.ts +++ b/cli/js/web/body.ts @@ -100,7 +100,6 @@ export class Body implements domTypes.Body { } if (this._bodySource instanceof ReadableStreamImpl) { - // @ts-ignore this._stream = this._bodySource; } if (typeof this._bodySource === "string") { @@ -290,7 +289,6 @@ export class Body implements domTypes.Body { enc.encode(this._bodySource).buffer as ArrayBuffer ); } else if (this._bodySource instanceof ReadableStreamImpl) { - // @ts-ignore return bufferFromStream(this._bodySource.getReader()); } else if (this._bodySource instanceof FormData) { const enc = new TextEncoder(); diff --git a/cli/js/web/console.ts b/cli/js/web/console.ts index 7a3f9241e..69c9d3137 100644 --- a/cli/js/web/console.ts +++ b/cli/js/web/console.ts @@ -223,7 +223,7 @@ function groupEntries<T>( let order = "padStart"; if (value !== undefined) { for (let i = 0; i < entries.length; i++) { - //@ts-ignore + //@ts-expect-error if (typeof value[i] !== "number" && typeof value[i] !== "bigint") { order = "padEnd"; break; @@ -239,7 +239,7 @@ function groupEntries<T>( for (; j < max - 1; j++) { // In future, colors should be taken here into the account const padding = maxLineLength[j - i]; - //@ts-ignore + //@ts-expect-error str += `${entries[j]}, `[order](padding, " "); } if (order === "padStart") { @@ -412,7 +412,7 @@ function createMapString( }, group: false, }; - //@ts-ignore + //@ts-expect-error return createIterableString(value, ctx, level, maxLevel, printConfig); } @@ -494,7 +494,7 @@ function createRawObjectString( let baseString = ""; let shouldShowDisplayName = false; - // @ts-ignore + // @ts-expect-error let displayName = value[Symbol.toStringTag]; if (!displayName) { displayName = getClassInstanceName(value); @@ -515,7 +515,7 @@ function createRawObjectString( for (const key of symbolKeys) { entries.push( `${key.toString()}: ${stringifyWithQuotes( - // @ts-ignore + // @ts-expect-error value[key], ctx, level + 1, @@ -949,7 +949,7 @@ export class Console { name: "Trace", message, }; - // @ts-ignore + // @ts-expect-error Error.captureStackTrace(err, this.trace); this.error((err as Error).stack); }; diff --git a/cli/js/web/fetch.ts b/cli/js/web/fetch.ts index ec75d67cb..a56ebe772 100644 --- a/cli/js/web/fetch.ts +++ b/cli/js/web/fetch.ts @@ -282,7 +282,7 @@ export async function fetch( method = input.method; headers = input.headers; - //@ts-ignore + //@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 90b6bba94..87b23de06 100644 --- a/cli/js/web/timers.ts +++ b/cli/js/web/timers.ts @@ -239,7 +239,7 @@ export function setTimeout( ...args: Args ): number { checkBigInt(delay); - // @ts-ignore + // @ts-expect-error checkThis(this); return setTimer(cb, delay, args, false); } @@ -250,7 +250,7 @@ export function setInterval( ...args: Args ): number { checkBigInt(delay); - // @ts-ignore + // @ts-expect-error checkThis(this); return setTimer(cb, delay, args, true); } |