diff --git a/cli/js/error_stack.ts b/cli/js/error_stack.ts index e77f0865c9..8a3d0530b0 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 c84be68b1a..79273ed338 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 3e81fc6801..97205d205f 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 ed735fd52a..4e92663a1b 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 09acdc23d0..fc32fd604f 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 9c4997755c..ffe3f0e595 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 7a3f9241e4..69c9d3137a 100644 --- a/cli/js/web/console.ts +++ b/cli/js/web/console.ts @@ -223,7 +223,7 @@ function groupEntries( 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( 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 ec75d67cbe..a56ebe772e 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 90b6bba949..87b23de067 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); } diff --git a/cli/tests/042_dyn_import_evalcontext.ts b/cli/tests/042_dyn_import_evalcontext.ts index 124a406d24..e1cc485d14 100644 --- a/cli/tests/042_dyn_import_evalcontext.ts +++ b/cli/tests/042_dyn_import_evalcontext.ts @@ -1,4 +1,4 @@ -// @ts-ignore +// @ts-expect-error Deno.core.evalContext( "(async () => console.log(await import('./subdir/mod4.js')))()" ); diff --git a/cli/tests/unit/body_test.ts b/cli/tests/unit/body_test.ts index c8f783e043..fd91b5cedd 100644 --- a/cli/tests/unit/body_test.ts +++ b/cli/tests/unit/body_test.ts @@ -42,7 +42,7 @@ unitTest( const body = buildBody(text); - // @ts-ignore + // @ts-expect-error body.contentType = "multipart/form-data;boundary=boundary"; const formData = await body.formData(); @@ -62,7 +62,7 @@ unitTest( const body = buildBody(text); - // @ts-ignore + // @ts-expect-error body.contentType = "application/x-www-form-urlencoded"; const formData = await body.formData(); diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts index 02d71e4ca1..35985dc1c2 100644 --- a/cli/tests/unit/console_test.ts +++ b/cli/tests/unit/console_test.ts @@ -22,7 +22,7 @@ const customInspect = Deno.customInspect; const { Console, stringifyArgs, - // @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol + // @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol } = Deno[Deno.internal]; function stringify(...args: unknown[]): string { @@ -590,7 +590,7 @@ unitTest(function consoleTestStringifyIterable() { 0, <120 empty items> ]` ); -*/ + */ }); unitTest(async function consoleTestStringifyPromises(): Promise { @@ -727,7 +727,6 @@ unitTest(function consoleTestCallToStringOnLabel(): void { mockConsole((console) => { for (const method of methods) { let hasCalled = false; - // @ts-ignore console[method]({ toString(): void { hasCalled = true; diff --git a/cli/tests/unit/dispatch_json_test.ts b/cli/tests/unit/dispatch_json_test.ts index 4e95b86a28..51c33befde 100644 --- a/cli/tests/unit/dispatch_json_test.ts +++ b/cli/tests/unit/dispatch_json_test.ts @@ -20,9 +20,9 @@ unitTest( ); unitTest(function malformedJsonControlBuffer(): void { - // @ts-ignore + // @ts-expect-error const opId = Deno.core.ops()["op_open"]; - // @ts-ignore + // @ts-expect-error const res = Deno.core.send(opId, new Uint8Array([1, 2, 3, 4, 5])); const resText = new TextDecoder().decode(res); // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/cli/tests/unit/dispatch_minimal_test.ts b/cli/tests/unit/dispatch_minimal_test.ts index afc17f4fb8..1c7ba11f0f 100644 --- a/cli/tests/unit/dispatch_minimal_test.ts +++ b/cli/tests/unit/dispatch_minimal_test.ts @@ -26,9 +26,9 @@ unitTest(async function sendAsyncStackTrace(): Promise { }); unitTest(function malformedMinimalControlBuffer(): void { - // @ts-ignore + // @ts-expect-error const readOpId = Deno.core.ops()["op_read"]; - // @ts-ignore + // @ts-expect-error const res = Deno.core.send(readOpId, new Uint8Array([1, 2, 3, 4, 5])); const header = res.slice(0, 12); const buf32 = new Int32Array( diff --git a/cli/tests/unit/dom_iterable_test.ts b/cli/tests/unit/dom_iterable_test.ts index b9435b3bcc..c4e535a257 100644 --- a/cli/tests/unit/dom_iterable_test.ts +++ b/cli/tests/unit/dom_iterable_test.ts @@ -20,7 +20,7 @@ function setup() { Base, // This is using an internal API we don't want published as types, so having // to cast to any to "trick" TypeScript - // @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol + // @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol DomIterable: Deno[Deno.internal].DomIterableMixin(Base, dataSymbol), }; } diff --git a/cli/tests/unit/error_stack_test.ts b/cli/tests/unit/error_stack_test.ts index e5cedfcf51..eb0a5c0e66 100644 --- a/cli/tests/unit/error_stack_test.ts +++ b/cli/tests/unit/error_stack_test.ts @@ -1,7 +1,7 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import { unitTest, assert } from "./test_util.ts"; -// @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol +// @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol const { setPrepareStackTrace } = Deno[Deno.internal]; interface CallSite { diff --git a/cli/tests/unit/event_target_test.ts b/cli/tests/unit/event_target_test.ts index 0c4eb4d0dd..cfbe5285b2 100644 --- a/cli/tests/unit/event_target_test.ts +++ b/cli/tests/unit/event_target_test.ts @@ -4,11 +4,8 @@ import { unitTest, assertEquals } from "./test_util.ts"; unitTest(function addEventListenerTest(): void { const document = new EventTarget(); - // @ts-ignore tests ignoring the type system for resilience assertEquals(document.addEventListener("x", null, false), undefined); - // @ts-ignore assertEquals(document.addEventListener("x", null, true), undefined); - // @ts-ignore assertEquals(document.addEventListener("x", null), undefined); }); @@ -71,11 +68,8 @@ unitTest(function anEventTargetCanBeSubclassed(): void { unitTest(function removingNullEventListenerShouldSucceed(): void { const document = new EventTarget(); - // @ts-ignore assertEquals(document.removeEventListener("x", null, false), undefined); - // @ts-ignore assertEquals(document.removeEventListener("x", null, true), undefined); - // @ts-ignore assertEquals(document.removeEventListener("x", null), undefined); }); diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index ed17c869a3..97b001b552 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -93,7 +93,7 @@ unitTest({ perms: { net: true } }, async function fetchBodyUsed(): Promise< assertEquals(response.bodyUsed, false); assertThrows((): void => { // Assigning to read-only property throws in the strict mode. - // @ts-ignore + // @ts-expect-error response.bodyUsed = true; }); await response.blob(); @@ -595,7 +595,7 @@ unitTest({ perms: { net: true } }, async function fetchBodyReadTwice(): Promise< const methods = ["json", "text", "formData", "arrayBuffer"]; for (const method of methods) { try { - // @ts-ignore + // @ts-expect-error await response[method](); fail( "Reading body multiple times should failed, the stream should've been locked." diff --git a/cli/tests/unit/files_test.ts b/cli/tests/unit/files_test.ts index a035c70742..9ab74be895 100644 --- a/cli/tests/unit/files_test.ts +++ b/cli/tests/unit/files_test.ts @@ -290,7 +290,7 @@ unitTest( // writing null should throw an error let err; try { - // @ts-ignore + // @ts-expect-error await file.write(null); } catch (e) { err = e; @@ -322,7 +322,7 @@ unitTest( // reading file into null buffer should throw an error let err; try { - // @ts-ignore + // @ts-expect-error await file.read(null); } catch (e) { err = e; diff --git a/cli/tests/unit/form_data_test.ts b/cli/tests/unit/form_data_test.ts index 10cbd30a79..5344d8512a 100644 --- a/cli/tests/unit/form_data_test.ts +++ b/cli/tests/unit/form_data_test.ts @@ -41,9 +41,9 @@ unitTest(function formDataParamsGetSuccess(): void { formData.append("a", "true"); formData.append("b", "false"); formData.append("a", "null"); - // @ts-ignore + // @ts-expect-error formData.append("d", undefined); - // @ts-ignore + // @ts-expect-error formData.append("e", null); assertEquals(formData.get("a"), "true"); assertEquals(formData.get("b"), "false"); @@ -70,10 +70,10 @@ unitTest(function formDataParamsSetSuccess(): void { assertEquals(formData.getAll("b"), ["false"]); formData.set("a", "false"); assertEquals(formData.getAll("a"), ["false"]); - // @ts-ignore + // @ts-expect-error formData.set("d", undefined); assertEquals(formData.get("d"), "undefined"); - // @ts-ignore + // @ts-expect-error formData.set("e", null); assertEquals(formData.get("e"), "null"); }); @@ -134,7 +134,7 @@ unitTest(function formDataParamsArgumentsCheck(): void { let hasThrown = 0; let errMsg = ""; try { - // @ts-ignore + // @ts-expect-error formData[method](); hasThrown = 1; } catch (err) { @@ -158,7 +158,7 @@ unitTest(function formDataParamsArgumentsCheck(): void { let errMsg = ""; try { - // @ts-ignore + // @ts-expect-error formData[method](); hasThrown = 1; } catch (err) { @@ -178,7 +178,7 @@ unitTest(function formDataParamsArgumentsCheck(): void { hasThrown = 0; errMsg = ""; try { - // @ts-ignore + // @ts-expect-error formData[method]("foo"); hasThrown = 1; } catch (err) { diff --git a/cli/tests/unit/globals_test.ts b/cli/tests/unit/globals_test.ts index aa8b4f46e7..bb5e5c604b 100644 --- a/cli/tests/unit/globals_test.ts +++ b/cli/tests/unit/globals_test.ts @@ -48,12 +48,12 @@ unitTest(function webAssemblyExists(): void { unitTest(function DenoNamespaceImmutable(): void { const denoCopy = window.Deno; try { - // @ts-ignore + // @ts-expect-error Deno = 1; } catch {} assert(denoCopy === Deno); try { - // @ts-ignore + // @ts-expect-error window.Deno = 1; } catch {} assert(denoCopy === Deno); @@ -64,7 +64,7 @@ unitTest(function DenoNamespaceImmutable(): void { const { readFile } = Deno; try { - // @ts-ignore + // @ts-expect-error Deno.readFile = 1; } catch {} assert(readFile === Deno.readFile); @@ -73,19 +73,19 @@ unitTest(function DenoNamespaceImmutable(): void { } catch {} assert(readFile === Deno.readFile); - // @ts-ignore + // @ts-expect-error const { print } = Deno.core; try { - // @ts-ignore + // @ts-expect-error Deno.core.print = 1; } catch {} - // @ts-ignore + // @ts-expect-error assert(print === Deno.core.print); try { - // @ts-ignore + // @ts-expect-error delete Deno.core.print; } catch {} - // @ts-ignore + // @ts-expect-error assert(print === Deno.core.print); }); diff --git a/cli/tests/unit/headers_test.ts b/cli/tests/unit/headers_test.ts index aaa8298379..6dd60c8c56 100644 --- a/cli/tests/unit/headers_test.ts +++ b/cli/tests/unit/headers_test.ts @@ -7,7 +7,7 @@ import { } from "./test_util.ts"; const { stringifyArgs, - // @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol + // @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol } = Deno[Deno.internal]; // Logic heavily copied from web-platform-tests, make @@ -18,7 +18,7 @@ unitTest(function newHeaderTest(): void { new Headers(undefined); new Headers({}); try { - // @ts-ignore + // @ts-expect-error new Headers(null); } catch (e) { assertEquals( @@ -32,7 +32,7 @@ const headerDict: Record = { name1: "value1", name2: "value2", name3: "value3", - // @ts-ignore + // @ts-expect-error name4: undefined, "Content-Type": "value4", }; @@ -269,7 +269,7 @@ unitTest(function headerParamsArgumentsCheck(): void { let hasThrown = 0; let errMsg = ""; try { - // @ts-ignore + // @ts-expect-error headers[method](); hasThrown = 1; } catch (err) { @@ -293,7 +293,7 @@ unitTest(function headerParamsArgumentsCheck(): void { let errMsg = ""; try { - // @ts-ignore + // @ts-expect-error headers[method](); hasThrown = 1; } catch (err) { @@ -313,7 +313,7 @@ unitTest(function headerParamsArgumentsCheck(): void { hasThrown = 0; errMsg = ""; try { - // @ts-ignore + // @ts-expect-error headers[method]("foo"); hasThrown = 1; } catch (err) { diff --git a/cli/tests/unit/internals_test.ts b/cli/tests/unit/internals_test.ts index abd4c94c3d..3f4bdae79e 100644 --- a/cli/tests/unit/internals_test.ts +++ b/cli/tests/unit/internals_test.ts @@ -4,7 +4,7 @@ import { unitTest, assert } from "./test_util.ts"; unitTest(function internalsExists(): void { const { stringifyArgs, - // @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol + // @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol } = Deno[Deno.internal]; assert(!!stringifyArgs); }); diff --git a/cli/tests/unit/request_test.ts b/cli/tests/unit/request_test.ts index 8a276c5e79..be6e956b77 100644 --- a/cli/tests/unit/request_test.ts +++ b/cli/tests/unit/request_test.ts @@ -10,7 +10,7 @@ unitTest(function fromInit(): void { }, }); - // @ts-ignore + // @ts-expect-error assertEquals("ahoyhoy", req._bodySource); assertEquals(req.url, "https://example.com"); assertEquals(req.headers.get("test-header"), "value"); @@ -18,13 +18,13 @@ unitTest(function fromInit(): void { unitTest(function fromRequest(): void { const r = new Request("https://example.com"); - // @ts-ignore + // @ts-expect-error r._bodySource = "ahoyhoy"; r.headers.set("test-header", "value"); const req = new Request(r); - // @ts-ignore + // @ts-expect-error assertEquals(req._bodySource, r._bodySource); assertEquals(req.url, r.url); assertEquals(req.headers.get("test-header"), r.headers.get("test-header")); @@ -44,6 +44,6 @@ unitTest(async function cloneRequestBodyStream(): Promise { assertEquals(b1, b2); - // @ts-ignore + // @ts-expect-error assert(r1._bodySource !== r2._bodySource); }); diff --git a/cli/tests/unit/streams_internal_test.ts b/cli/tests/unit/streams_internal_test.ts index f324da1945..f49c9f494e 100644 --- a/cli/tests/unit/streams_internal_test.ts +++ b/cli/tests/unit/streams_internal_test.ts @@ -8,7 +8,7 @@ unitTest(function streamReadableHwmError() { () => { new ReadableStream( undefined, - // @ts-ignore + // @ts-expect-error { highWaterMark } ); }, @@ -20,7 +20,7 @@ unitTest(function streamReadableHwmError() { assertThrows(() => { new ReadableStream( undefined, - // @ts-ignore + // @ts-expect-error { highWaterMark: Symbol("hwk") } ); }, TypeError); @@ -33,7 +33,7 @@ unitTest(function streamWriteableHwmError() { () => { new WritableStream( undefined, - // @ts-ignore + // @ts-expect-error new CountQueuingStrategy({ highWaterMark }) ); }, @@ -45,7 +45,7 @@ unitTest(function streamWriteableHwmError() { assertThrows(() => { new WritableStream( undefined, - // @ts-ignore + // @ts-expect-error new CountQueuingStrategy({ highWaterMark: Symbol("hwmk") }) ); }, TypeError); @@ -59,7 +59,7 @@ unitTest(function streamTransformHwmError() { new TransformStream( undefined, undefined, - // @ts-ignore + // @ts-expect-error { highWaterMark } ); }, @@ -72,7 +72,7 @@ unitTest(function streamTransformHwmError() { new TransformStream( undefined, undefined, - // @ts-ignore + // @ts-expect-error { highWaterMark: Symbol("hwmk") } ); }, TypeError); diff --git a/cli/tests/unit/unit_test_runner.ts b/cli/tests/unit/unit_test_runner.ts index 715dda5001..e3df358d7c 100755 --- a/cli/tests/unit/unit_test_runner.ts +++ b/cli/tests/unit/unit_test_runner.ts @@ -11,7 +11,7 @@ import { reportToConn, } from "./test_util.ts"; -// @ts-ignore +// @ts-expect-error const internalObj = Deno[Deno.internal]; // eslint-disable-next-line @typescript-eslint/no-explicit-any const reportToConsole = internalObj.reportToConsole as (message: any) => void; diff --git a/cli/tests/unit/url_search_params_test.ts b/cli/tests/unit/url_search_params_test.ts index 7b7dbab764..ce55a75205 100644 --- a/cli/tests/unit/url_search_params_test.ts +++ b/cli/tests/unit/url_search_params_test.ts @@ -177,7 +177,7 @@ unitTest(function urlSearchParamsAppendArgumentsCheck(): void { const searchParams = new URLSearchParams(); let hasThrown = 0; try { - // @ts-ignore + // @ts-expect-error searchParams[method](); hasThrown = 1; } catch (err) { @@ -194,7 +194,7 @@ unitTest(function urlSearchParamsAppendArgumentsCheck(): void { const searchParams = new URLSearchParams(); let hasThrown = 0; try { - // @ts-ignore + // @ts-expect-error searchParams[method]("foo"); hasThrown = 1; } catch (err) { @@ -235,7 +235,7 @@ unitTest(function urlSearchParamsCustomSymbolIterator(): void { unitTest( function urlSearchParamsCustomSymbolIteratorWithNonStringParams(): void { const params = {}; - // @ts-ignore + // @ts-expect-error params[Symbol.iterator] = function* (): IterableIterator<[number, number]> { yield [1, 2]; }; diff --git a/std/http/server_test.ts b/std/http/server_test.ts index 0560f7f8da..0423b87262 100644 --- a/std/http/server_test.ts +++ b/std/http/server_test.ts @@ -496,7 +496,6 @@ test({ async fn(): Promise { const serverRoutine = async (): Promise => { const server = serve(":8124"); - // @ts-ignore for await (const req of server) { await assertThrowsAsync(async () => { await req.respond({ diff --git a/std/mime/multipart_test.ts b/std/mime/multipart_test.ts index 61afdba036..b7c0cb969c 100644 --- a/std/mime/multipart_test.ts +++ b/std/mime/multipart_test.ts @@ -145,7 +145,7 @@ test("multipartMultipartWriter3", async function (): Promise { ); await assertThrowsAsync( async (): Promise => { - // @ts-ignore + // @ts-expect-error await mw.writeFile("bar", "file", null); }, Error, diff --git a/std/node/global.ts b/std/node/global.ts index c877d1d531..7d147cc4b1 100644 --- a/std/node/global.ts +++ b/std/node/global.ts @@ -5,5 +5,5 @@ Object.defineProperty(globalThis, Symbol.toStringTag, { configurable: true, }); -// @ts-ignore +// @ts-expect-error globalThis["global"] = globalThis; diff --git a/std/node/module.ts b/std/node/module.ts index 4e0c55c1d8..71c25beaca 100644 --- a/std/node/module.ts +++ b/std/node/module.ts @@ -263,9 +263,9 @@ class Module { message = message + "\nRequire stack:\n- " + requireStack.join("\n- "); } const err = new Error(message); - // @ts-ignore + // @ts-expect-error err.code = "MODULE_NOT_FOUND"; - // @ts-ignore + // @ts-expect-error err.requireStack = requireStack; throw err; } @@ -737,7 +737,7 @@ function tryPackage( `Cannot find module '${filename}'. ` + 'Please verify that the package.json has a valid "main" entry' ); - // @ts-ignore + // @ts-expect-error err.code = "MODULE_NOT_FOUND"; throw err; } @@ -882,7 +882,7 @@ function applyExports(basePath: string, expansion: string): string { `Package exports for '${basePath}' do not define ` + `a '${mappingKey}' subpath` ); - // @ts-ignore + // @ts-expect-error e.code = "MODULE_NOT_FOUND"; throw e; } @@ -982,7 +982,7 @@ function resolveExportsTarget( } else { e = new Error(`No valid exports main found for '${basePath}'`); } - // @ts-ignore + // @ts-expect-error e.code = "MODULE_NOT_FOUND"; throw e; } @@ -1007,7 +1007,7 @@ const CircularRequirePrototypeWarningProxy = new Proxy( { // eslint-disable-next-line @typescript-eslint/no-explicit-any get(target, prop): any { - // @ts-ignore + // @ts-expect-error if (prop in target) return target[prop]; emitCircularRequireWarning(prop); return undefined; @@ -1058,7 +1058,7 @@ type RequireWrapper = ( function wrapSafe(filename: string, content: string): RequireWrapper { // TODO: fix this const wrapper = Module.wrap(content); - // @ts-ignore + // @ts-expect-error const [f, err] = Deno.core.evalContext(wrapper, filename); if (err) { throw err; diff --git a/std/signal/test.ts b/std/signal/test.ts index 15ebbdcc72..13c2998db1 100644 --- a/std/signal/test.ts +++ b/std/signal/test.ts @@ -9,7 +9,7 @@ test({ fn() { assertThrows( () => { - // @ts-ignore + // @ts-expect-error signal(); }, Error, diff --git a/std/uuid/tests/isNil.ts b/std/uuid/tests/isNil.ts index 4514576daa..1f0db416e2 100644 --- a/std/uuid/tests/isNil.ts +++ b/std/uuid/tests/isNil.ts @@ -1,7 +1,6 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import { assert } from "../../testing/asserts.ts"; const { test } = Deno; -// @ts-ignore import { NIL_UUID, isNil } from "../mod.ts"; test({ diff --git a/std/ws/mod.ts b/std/ws/mod.ts index 324588af01..97c77baab0 100644 --- a/std/ws/mod.ts +++ b/std/ws/mod.ts @@ -491,7 +491,7 @@ export async function handshake( throw new Error("ws: invalid status line: " + statusLine); } - // @ts-ignore + // @ts-expect-error const { version, statusCode } = m.groups; if (version !== "HTTP/1.1" || statusCode !== "101") { throw new Error(