summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-05-27 00:02:16 +1000
committerGitHub <noreply@github.com>2020-05-26 10:02:16 -0400
commit228f9c207f8320908325a553c96e465da08fc617 (patch)
tree54f2aba9f577d713dcbed5882ae7ae9e53c7baaf
parent24c36fd8625df6b276108109478a62b4661a0b3f (diff)
Use ts-expect-error instead of ts-ignore. (#5869)
-rw-r--r--cli/js/error_stack.ts8
-rw-r--r--cli/js/repl.ts2
-rw-r--r--cli/js/runtime_main.ts4
-rw-r--r--cli/js/runtime_worker.ts4
-rw-r--r--cli/js/testing.ts4
-rw-r--r--cli/js/web/body.ts2
-rw-r--r--cli/js/web/console.ts12
-rw-r--r--cli/js/web/fetch.ts2
-rw-r--r--cli/js/web/timers.ts4
-rw-r--r--cli/tests/042_dyn_import_evalcontext.ts2
-rw-r--r--cli/tests/unit/body_test.ts4
-rw-r--r--cli/tests/unit/console_test.ts5
-rw-r--r--cli/tests/unit/dispatch_json_test.ts4
-rw-r--r--cli/tests/unit/dispatch_minimal_test.ts4
-rw-r--r--cli/tests/unit/dom_iterable_test.ts2
-rw-r--r--cli/tests/unit/error_stack_test.ts2
-rw-r--r--cli/tests/unit/event_target_test.ts6
-rw-r--r--cli/tests/unit/fetch_test.ts4
-rw-r--r--cli/tests/unit/files_test.ts4
-rw-r--r--cli/tests/unit/form_data_test.ts14
-rw-r--r--cli/tests/unit/globals_test.ts16
-rw-r--r--cli/tests/unit/headers_test.ts12
-rw-r--r--cli/tests/unit/internals_test.ts2
-rw-r--r--cli/tests/unit/request_test.ts8
-rw-r--r--cli/tests/unit/streams_internal_test.ts12
-rwxr-xr-xcli/tests/unit/unit_test_runner.ts2
-rw-r--r--cli/tests/unit/url_search_params_test.ts6
-rw-r--r--std/http/server_test.ts1
-rw-r--r--std/mime/multipart_test.ts2
-rw-r--r--std/node/global.ts2
-rw-r--r--std/node/module.ts14
-rw-r--r--std/signal/test.ts2
-rw-r--r--std/uuid/tests/isNil.ts1
-rw-r--r--std/ws/mod.ts2
34 files changed, 81 insertions, 94 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);
}
diff --git a/cli/tests/042_dyn_import_evalcontext.ts b/cli/tests/042_dyn_import_evalcontext.ts
index 124a406d2..e1cc485d1 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 c8f783e04..fd91b5ced 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 02d71e4ca..35985dc1c 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<void> {
@@ -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 4e95b86a2..51c33befd 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 afc17f4fb..1c7ba11f0 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<void> {
});
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 b9435b3bc..c4e535a25 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 e5cedfcf5..eb0a5c0e6 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 0c4eb4d0d..cfbe5285b 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 ed17c869a..97b001b55 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 a035c7074..9ab74be89 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 10cbd30a7..5344d8512 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 aa8b4f46e..bb5e5c604 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 aaa829837..6dd60c8c5 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<string, string> = {
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 abd4c94c3..3f4bdae79 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 8a276c5e7..be6e956b7 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<void> {
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 f324da194..f49c9f494 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<number>(
undefined,
- // @ts-ignore
+ // @ts-expect-error
{ highWaterMark }
);
},
@@ -20,7 +20,7 @@ unitTest(function streamReadableHwmError() {
assertThrows(() => {
new ReadableStream<number>(
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 715dda500..e3df358d7 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 7b7dbab76..ce55a7520 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 0560f7f8d..0423b8726 100644
--- a/std/http/server_test.ts
+++ b/std/http/server_test.ts
@@ -496,7 +496,6 @@ test({
async fn(): Promise<void> {
const serverRoutine = async (): Promise<void> => {
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 61afdba03..b7c0cb969 100644
--- a/std/mime/multipart_test.ts
+++ b/std/mime/multipart_test.ts
@@ -145,7 +145,7 @@ test("multipartMultipartWriter3", async function (): Promise<void> {
);
await assertThrowsAsync(
async (): Promise<void> => {
- // @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 c877d1d53..7d147cc4b 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 4e0c55c1d..71c25beac 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 15ebbdcc7..13c2998db 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 4514576da..1f0db416e 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 324588af0..97c77baab 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(